Ant load property file and pass value as arg when exec java file -
how can load value property file , pass arg when want execute java file?
the content file of aa.properties: home_path=c:/myhome/apps
the ant:
<target name="tst"> <property file="aa.properties"/> <property name="homepath" value="${home_path}/"/> <java classpathref="clspath" classname="com.mytest.myapp" fork="true"> <arg value="${homepath}"/> </java> </target>
you pass other argument java task via nested arg values or arg line
note vmargs f.e. -dwhatever=foobar passed jvmarg java task
f.e. propertyfile aa.properties looks :
vmarg.foo=-dsomevalue=whatever arg.key=value arg.foo=bar ...
ant then
<target name="tst"> <property file="aa.properties"/> <property name="homepath" value="${home_path}/"/> <java classpathref="clspath" classname="com.mytest.myapp" fork="true"> <jvmarg value="${vmarg.foo}"/> <arg value="${homepath}"/> <arg value="${arg.key}"/> <arg value="${arg.foo}"/> ... </java> </target>
Comments
Post a Comment