File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
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 ..
 
wood burning stoves
 
subject: urgent help on passing parameters thru ant script