ant - passing parameter from build.xml to java file -
when run java test file(single file) through eclipse passing arguments
-dapproot=ecm -dappname=esw -dapp.module=fnt -dapp.env=loc -dclonenumber=1
test file executes without error, if dont give arguments error occurs not resolve placeholder 'approot'.
i have junit target generate report in html format.
<target name="junit" depends="init-junit"> <junit printsummary="on" fork="yes" forkmode="perbatch" haltonfailure="false" failureproperty="junit.failure" showoutput="false"> <classpath> <path refid="classpath_junit"/> </classpath> <batchtest fork="no" todir="${test_build_dir}"> <fileset dir="${comp_test_src}"> <include name="**/*test.java" /> </fileset> </batchtest> <formatter type="xml" /> </junit> <junitreport todir="${junit_report}"> <fileset dir="${test_build_dir}"> <include name="test-*.xml" /> </fileset> <report format="frames" todir="${junit_report}"/> </junitreport> </target>
when run above build script, getting following error: not resolve placeholder 'approot' has passed arguments.
i have passed parameter build.xml through eclipse, parameter passes build.xml file not passing java files. how can solve this?
edit: tried following parameter:
<junit printsummary="on" fork="yes" forkmode="perbatch" haltonfailure="false" failureproperty="junit.failure" showoutput="false"> <jvmarg value="-dapproot=ecm" /> <jvmarg value="-dappname=esw" /> <jvmarg value="-dapp.module=fnt" /> <jvmarg value="-dapp.env=loc" /> <jvmarg value="-dclonenumber=1" /> <!--<sysproperty key="approot" value="${approot}"/> <sysproperty key="appname" value="${appname}"/> <sysproperty key="app.module" value="${app.module}"/> <sysproperty key="app.env" value="${app.env}"/> <sysproperty key="clonenumber" value="${clonenumber}"/>--> <classpath> <path refid="classpath_junit"/> </classpath>
with system paramter works fine takes long time execute. jvmarg doesnt work. same error
<jvmarg value="-dapproot=${approot}" />
http://ant.apache.org/manual/tasks/junit.html doesn't define restriction sys , jvm args.
the documentation of junit ant task shows it:
<junit fork="yes" ...> <jvmarg value="-dapproot=ecm" /> </junit>
if approot property passed system property ant, may access ant property:
<junit fork="yes" ...> <jvmarg value="-dapproot=${approot}" /> </junit>
Comments
Post a Comment