Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

urgent help on passing parameters thru ant script

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe using <arg value="..."> in <junit> will work.
 
Tom Eric
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ..
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic