2014-11-03 86 views
1

我使用Launch4j並將在其配置中使用屬性${dist}如何在Launch4j配置文件中使用屬性擴展

它工作任務的時候,它的參數直接是在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>作爲根元素。 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配置文件中的屬性的解決方案?

+1

您可能希望在使用「config.xml」之前「擴展」您的模板,方法是使用filterset進行復制。有關示例,請參閱http://ant.apache.org/manual/Types/filterset.html – halfbit 2014-11-03 13:16:51

回答

1

launch4j的代碼不接受這樣的參數替換,但我可以改變這種行爲(修改爲net.sf.launch4j.config.ConfigPersister)。我有充足的時間在Sourceforge項目中檢查它。

+0

我實際上不會檢查此更改,因爲它引入了一些不希望出現的'ConfigPersiser'與'ant'的依賴關係。 @halfbit的[評論]越好越好(http://stackoverflow.com/questions/26714942/how-use-property-expansion-in-a-launch4j-config-file/26717871#comment42020691_26714942) – 2015-07-07 13:17:58