2010-11-19 40 views
4

有谁知道如何将构建属性传递给ANT中的izpack。izpack和build.properties

我有一个工作在ANT izpack安装,它工作正常,但我必须记得手动把东西像版本号等..这是在我的build.properties文件。

TIA

回答

4

您可以使用@{}语法的IzPack安装定义参考Ant属性:

<installation version="1.0"> 
     <!-- Ant properties in this file can be referenced with @{}, 
      otherwise use variables below in installer files with ${} --> 
     <info> 
     <appname>@{product.name}</appname> 
     <appversion>@{product.version}</appversion> 
     <uninstaller name="remove.task" path="${INSTALL_PATH}/Uninstall" write="yes"/> 
     </info> 
... 

Source

+0

我使用 我似乎能够不使用 @ {} release.version其在build.properties sproketboy 2010-11-20 01:49:17

+0

@丹定义 - 你在哪里硬编码的版本号?在你的install.xml中?这就是您可以像示例中那样使用@ {}语法来引用Ant属性的地方。 – 2010-11-20 08:51:44

+0

它在“build.properties”文件中。我有表达式$ {release.version},它可以在build.xml中正常工作 - 问题是如何将这些值传递给install.xml – sproketboy 2010-11-20 10:00:46

0

我找到了一种方法。我将安装复制到我的dist文件夹并在那时替换。

<copy file="install.xml" todir="${output.dir}" overwrite="true"> 
    <filterset> 
    <filter token="release.version" value="${release.version}"/> 
    </filterset> 
</copy> 

以后:

<target name="installer" description="Build installer" depends="all"> 
    <izpack input="${output.dir}/install.xml" output="c:/temp/test.jar" basedir="${release.dir}"/> 
    </target> 
2

看来,为了传播所有项目属性所涉及的的IzPack编译器,你需要设置inheritAll属性为“真正”。

<izpack input="install-definition.xml" 
    output="${output.dir}/${product.short.name}-${product.version}-install.jar" 
    installerType="standard" 
    inheritAll="true" 
    basedir="${temp.dir}" /> 

然后在您安装定义文件中使用@ {} product.version

但是引用的财产,我找不到它的文件,因此它可能比继承属性的更多。