What i want :
Generate jar file with apps version in name, Ex : MyApps-1.3_Beta.jar
In my src folder , i have a file named “version.properties” which contain :
…
apps=MyApps
apps.version=1.3_Beta
…
i need to change value of property “dist.jar” to something like this :
dist/${apps}-${apps.version}.jar
build.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyApps" default="default" basedir=".">
<description>Builds, tests, and runs the project MyApps.</description>
<target name="-pre-init">
<property file="${src.dir}\MyApps\version.properties"/>
<property name="dist.jar" value="dist/${apps}-${apps.version}.jar" />
</target>
<import file="nbproject/build-impl.xml"/>
<import file="nbproject/profiler-build-impl.xml"/>
<echo level="info">${dist.jar} instead of dist/${apps}-${apps.version}.jar</echo>
</project>
Echo output :
dist/${apps}-${apps.version}.jar instead of dist/MyApps-1.3_Beta.jar
The problem is that ${…} is not interpreted, and i don’t know why.
I can’t modify “build-impl.xml” because it can be regenerate by Netbeans (When i modify this file (all ${dist.jar}), it works but it’s not a good solution).
How can i change “dist.jar” property ?
NB: it’s not a problem if for change “dist.jar” I’m not using “project.properties”, project name and apps name can be different, but for “dist” folder it will be better to use it
It looks like you’re not reading the properties file you want. Run Ant with the
-verbosearg and you may see something like:(In the text you say the properties file is in the
srcdirectory, but the buildfile is looking for it in src\MyApps.)