How to set ${ant.project.name} value? I want to set it as: ${ant.project.name}=${basedir}
I don't want to set the project name from build.xml. My idea is - it should take the name of the folder automatically.
Is this possible?
The ANT property ant.project.name is designed to return the string that appears at the top of your build file. It has special meaning and shouldn't really be changed.
The following example demonstrates how you could use an alternative property (This should work on windows as well):
<project name="demo" default="run">
<basename property="my.project.name" file="${basedir}"/>
<target name="run">
<echo message="ant.project.name=${ant.project.name}"/>
<echo message="my.project.name=${my.project.name}"/>
</target>
</project>
Has the following output
run:
[echo] ant.project.name=demo
[echo] my.project.name=myprojectdirname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With