jQuery in Action, 2nd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes urgent help on passing parameters thru ant script Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "urgent help on passing parameters thru ant script" Watch "urgent help on passing parameters thru ant script" New topic
Author

urgent help on passing parameters thru ant script

Tom Eric
Greenhorn

Joined: Nov 03, 2003
Posts: 9
Hi,
I am trying to run java code thru junit using ant script.
I need to send the authentication information and some other parameters to junit (jvm..)
How do i pass a parameter to jvm from ant script..
I read ant manual and i am trying to use <jvmarg> tag to pass parameters
but it is not working ..
Can any one help me how to pass parameters to JVM thru ant script ...
My NumberTest.java file has to access data from database.
To access data base I need to send some parameters to Junit JVM like
username, password, authentication information file etc ...

Tahnks.
Here is my code ..
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project name="test" default="all" basedir=".">
<target name="compile" >
<javac srcdir="." debug="on" />
</target>
<target name="all" depends="compile" >
<junit fork="yes" printsummary="yes" haltonfailure="yes">
<jvmarg value="-DJavaCommitTrue"/>
<jvmarg value="-Djava.security.auth.login.config=c:\jboss-3.2.1\client\auth.conf"/>
<classpath>
<pathelement location="c:\ant\lib" />
</classpath>

<formatter type="plain"/>
<test name="test.NumberTests" haltonfailure="no" outfile="result">
</test>
</junit>
</target>

</project>
Goncha
Greenhorn

Joined: Aug 12, 2003
Posts: 4
Maybe using <arg value="..."> in <junit> will work.
Tom Eric
Greenhorn

Joined: Nov 03, 2003
Posts: 9
Hi,
Thanks for your reply .
I need to use <jvmarg value="..." /> only. Previouly I am passing entire thing in value where as if i pass each value using <jvmarg> tag it is working fine ..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: urgent help on passing parameters thru ant script
 
Similar Threads
JUnit ant batch process failing
Ant 1.7 + Junit 4 problems
ant junitreport - producing html file with no test results
any help how to send emails using ant
ANT issues - Unable to create JUnit Reports- Please help