1

我使用 Launch4j 并将${dist}在其配置中使用一个属性。

当任务和它的参数直接在build.xml文件中时,它可以工作:

<project ...>
    <property name="dist" location="/temp/dist" />
    <launch4j>
        <config headerType="gui" outfile="${dist}/myprogram.exe"
            dontWrapJar="false" jarPath="${dist}/myprogram.jar">
            ...
        </config>
    </launch4j>

</project>

然而,Launch4j 可以使用它自己的 xml 配置文件,<launch4jConfig>作为根元素:

在 ant.xml 中:

<launch4j configFile="my_launch4j_config.xml" />

在 my_launch4j_config.xml 中:

<launch4jConfig>
    <headerType>gui</headerType>
    <outfile>${dist}/myprogram.exe</outfile>
    <dontWrapJar>false</dontWrapJar>
        <jar>${dist}/myprogram.jar</jar>
        ...
</launch4jConfig>

在这种情况下,${dist}没有扩展,也没有%dist%我尝试过的所有内容......是否存在使用 launch4j 配置文件中的属性的解决方案?

4

1 回答 1

1

launch4j 的代码不接受这样的参数替换,但我可以改变这种行为(修改为net.sf.launch4j.config.ConfigPersister)。当我有足够的时间时,我会在 Sourceforge 项目中检查它。

于 2014-11-03T15:53:20.110 回答