Ant Question

Hi I'm running this block of ant code,
<target name="tests"
               depends="ant15"
               description="Runs junit tests">
          <mkdir dir="${testreport.dir}"/>
                    <property name="testinputs.dir" location="../im"/>
                    <property name="testcases" value="HptlTest.class"/>
                    <junit printsummary="yes"
                           fork="yes"
                           forkmode="perBatch"
                           haltonfailure="no"
                           showoutput="yes"
                           failureProperty="tests.have.failed">
                         <jvmarg value="-Dtestinputs.dir=${testinputs.dir}"/>
                        <formatter type="xml" />
                            <classpath path="../test/bin/classes"/>
                         <test todir="../test/bin/classes/" name="com.test.domain.HptlTest"/>
                   </junit>
                    <junitreport todir="${testreport.dir}">
                          <fileset dir="${testreport.dir}">
                            <include name="TEST-*.xml"/>
                          </fileset>
                          <report todir="${testreport.dir}"/>
              </junitreport>
                   <echo>Tests task completed!</echo>
                    <fail if="tests.have.failed"
          message="Unit tests failed - Report is available in ${report}"/>
    </target>
however I get this exception,
    [junit] Running com.test.domain.HptlTest
    [junit] Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
    [junit]     at java.lang.Class.forName0(Native Method)
    [junit]     at java.lang.Class.forName(Class.java:164)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:204)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:177)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:651)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)
    [junit] Test com.raytheon.jetts.domain.HptlTest FAILED
[junitreport] Transform time: 600ms
basically my hibernate2.jar cannot be found in order to run the Junit test method, how can I load all my necessary jars at once in ant,
I know the location of all the jars but I don't know how to load them into the classpath for this target to run successfully,
could someone show me an example of how to do this?
Thanks in advance?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Specify the location of the junit JAR within a <classpath> element in the <junit> task. See the Ant apache task 'javac' for examples of what a <classpath> element nested inside of a task looks like.
- Saish

Similar Messages

  • EJB newbie - ant question

    Hi,
    This is an ant question. Hope it is ok for me to ask this here.
    I have a windows xp machine.
    I have ant installed in C:\libraries\apache-ant-1.6.1
    ANT_HOME=C:\libraries\apache-ant-1.6.1\
    PATH has C:\libraries\apache-ant-1.6.1\bin
    ANT home is a system variable.
    Inspite of this, I am not able to use ant.
    I get the following error. Am i missing something?
    ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.
    Thanks,
    Suma

    Hi !
    please do the following
    1. go to the desktop and right click on the mycomputer and select properties
    2.click advanced tab on the properties
    3. then click on the environment variables.
    then in the environment variables choose path for the system variables
    in that path
    suppose you installed ant in c:\libraries
    edit path: c:\libraries\ant1.6.1\bin;.;
    and also go to the systemvariable classpath
    and edit classpath as
    add this
    c:\libraries\ant1.6.1\lib;.;
    then close the properties box
    open the command prompt
    and type ant
    definetly it will work...

  • Basic Ant Question

    Any Ant experts out there? This is such a basic question and I'm surprised it's not attacked point-blank in the Ant docs. I must be missing something.
    I'm trying to use ant to build a makefile that can be used on both Unix and Windows. Basically the only difference between the two environments will be the name of the company root directory (designated by the environment variable CAEROOT which is defined under both OS's).
    How can I access that environment variable with ant??? The obvious attempt shown below doesn't work because I guess Ant thinks it's a property.
    <code>
    <project name="XMLDBBridge" default="compile" basedir=".">
    <!-- set global properties for this build -->
    <property name="src" value="src"/>
    <property name="build" value="classes"/>
    <property name="caeroot" value="${CAEROOT}/"/>
    <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    </target>
    <target name="compile" depends="init">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" classpath="${caeroot}/JLib/OracleJDBC/;
    ${caeroot}/JLib/OracleXDK/lib/xsu12.jar"/>
    </target>
    <target name="clean">
    <!-- Delete the ${build} directory trees -->
    <delete dir="${build}"/>
    </target>
    </project>
    </code>

    In case anyone else ever has this same problem.
    I finally figured out how to get environment variables working in ant. It's quite nice but doesn't really figure anywhere in the docs even though I feel its one of the key usages for ant.
    <code>
    <project name="XMLDBBridge" default="compile" basedir=".">
    <!-- set global properties for this build -->
    <property name="src" value="src"/>
    <property name="build" value="classes"/>
    <property environment="envvar"/>
    <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    </target>
    <target name="compile" depends="init">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" classpath="${envvar.CAEROOT}/JLib/OracleJDBC/;
    ${envvar.CAEROOT}/JLib/OracleXDK/lib/xsu12.jar"/>
    </target>
    <target name="clean">
    <!-- Delete the ${build} directory trees -->
    <delete dir="${build}"/>
    </target>
    </project>
    </code>

  • Ant question: difference btwn source-path/compiler-source-path/include-libraries

    I have a few questions about build.xml include/lib directories (questions in xml file)
    <mxmlc>
    <source-path="../frameworks"/>
    <compiler.source-path path-element="path to include actionscript include similar to c include"/>
    <compiler.include-libraries dir="${basedir}">
        <include name="I have no idea what this is. Does flex generate binaries similar to how c compilers generate .so or .dll?"/>
    </compiler.include-libraries>
    </mxmlc>
    1. What's the difference between source-path and compiler.source-path
    2. So what exactly is a compiler.include-libraries?  Just curious what produces a library.
    I've had success accessing actions script files that reside in other directories using compiler.source-path but not source-path.  Any help appreciated
    Regards,
    Monty

    I have a few questions about build.xml include/lib directories (questions in xml file)
    <mxmlc>
    <source-path="../frameworks"/>
    <compiler.source-path path-element="path to include actionscript include similar to c include"/>
    <compiler.include-libraries dir="${basedir}">
        <include name="I have no idea what this is. Does flex generate binaries similar to how c compilers generate .so or .dll?"/>
    </compiler.include-libraries>
    </mxmlc>
    1. What's the difference between source-path and compiler.source-path
    2. So what exactly is a compiler.include-libraries?  Just curious what produces a library.
    I've had success accessing actions script files that reside in other directories using compiler.source-path but not source-path.  Any help appreciated
    Regards,
    Monty

  • Ant question about copying dirs

    HI all,
    I want do copy a folder into another folder (incl. files!)
    i have for example :
    /app/foldera
    and /app/destination/
    and i want to copy folder a into destination so that it looks like this in the end:
    /app/destination/foldera
    I'm using ANT-151

    its simply not posibble
    the only option is
    read each file in a folder subfolder...
    adn write again ...
    but is it worth whats the hell of time its going to take..
    and will it be successfull...i doubt..
    one can try
    using runtime class called command process and pasing argument copy *.* from a b

  • Ant questions: for Swing apps?

    I have used Ant for my J2EE programs by deploying the ear file to the server. For my swing desktop apps I have used an executable Jar file, or JBuilder makes me a windows .exe file.
    Can you use ant builds to make something appropriate for deploying Swing apps?
    Thanks!
    Amber

    Does this link help ?
    http://ant.apache.org/manual/CoreTasks/jar.html

  • WebLogic/Ant question

    I have a folder containing a whole bunch of EJB deployment descriptors. I've been developing in JBoss (because it's free!) but now need to deploy under WebLogic, which requires, in addition to the J2EE requirements, this weblogic-ejb-jar.xml. Is there a good way to automate the creation of these in Ant when it's building the project?

    Ant cannot create or write to text files, specifically an XML file. It can however copy an XML file, paste, rename or wrap it in a JAR file. I highly recommend using Ant for your builds, but I don't think it will help you create and XML file.
    tj...

  • Newbie ANT question

    as my codebase is growing, and the number of applications within in are increasing I figured it would be a smart move to switch to using ANT, but I am having a bit of trouble configuring it to work the way i would like. I have read several tutorials, but they dont seem to get into enough detail.
    Basically, all I want to do, is compile only specific packages related to an application, and then run the main method of that application.
    In addition, I want to jar up those specific packages only.
    Since, I have several large applications all under the same root
    directory, I figured this would help reduce compile time, and allow me
    to be a bit more organized.
    If anyone could give me some hints, or point me in the right direction. I
    would appreciate it!
    thanks!

    so I am trying something like this:
    <target name="jar" depends="dist" description="generate the jar" >
         <jar destfile="${dist}/app.jar">
    <fileset dir="${classes}/com/domain/package1"/>
    <fileset dir="${classes}/com/domain/package2"/>
    </jar>
    </target>
    What I want is a new jar file which has all the classes in these directories (recursively).
    But I also want to maintain the directory hierarchy. i.e. com/domain/package1...but I cant figure this out, and all of the subdirectories from package1 & package2 are on the base level.

  • "Deploy portal with ant" question

    Hello Experts!
    I am quite new to WebCenter, and I have a requirement to automate compile and deploy tasks of my Portal Application (Framework Application). I have read some docs and blogs and this forum too. Could you clarify me the difference between following:
    - deploy through ojdeploy
    - wldeploy
    - python script (WLST)?

    ojdeploy allows you to use the Deployment Targets defined in your JDeveloper project/workspace. I have found this the simplest way to package up my code into an ADF Library JAR or an EAR file.
    wldeploy is an ant wrapper for the functionality provided by weblogic.Deployer i.e. deploy related functions.
    wlst is a jython based command-line utility that provides deployer functions and also administrative functions. I prefer using wlst for my deployments. I usually invoke wlst via the "exec" task in Ant.

  • Ant Questions

    Does Ant uses his own JVM to run programs( with <java> command )?
    Does Ant uses his own Compiler to compile source files( with <compile> command )?
    Thanks

    Does this link help ?
    http://ant.apache.org/manual/CoreTasks/jar.html

  • Import-ant question

    There's an easy answer to this, I just don't know it.
    import java.lang.Math;
    public class Jtest
    public static void main(String[] args)
    double a, b=0.0,c = 0.0;
    a = pow(b,c);
    I get an error saying the pow(double,double) is not defined for the type Jtest
    if i do:
    a = java.lang.Math.pow (x,y);
    then no problem, but since i have imported it, i shouldn't have to do this.
    what am i doing wrong?
    Thanks

    ...just a correction of the above: you vannot create an instance of java.lang.Math class! because it's constructor is final.
    The correct way of using java.lang.Math is the static way:
    Math.pow(x, y)/Andrew

  • Default Target Main Build does not exist in this project

    I am learning ant with eclipse and wanted to use ant build.xml to compile and run my class. I was getting the following error when i just tried to use ant.
    Default Target Main Build does not exist in this project
    package src;
    public class Ch05_02 {
        public static void main(String[] args) {
            System.out.println("This code was built using Ant.");
    <?xml version="1.0" encoding = "UTF-8"?>
    <project name="Ch05_02" default="Main Build" basedir=".">
    </project>Ref: http://www.javabeginner.com/Ch05_02.zip
    Edited by: hemanthjava on Oct 28, 2007 5:43 AM

    You gave a default target in the build.xml, and then didn't define the target.
    This is an Ant question. You're better off asking Ant questions on an Ant forum.

  • Error target 'sda.icssb2b' does not exist in this project

    Hello sir,
    I want to build ear(Application Archive) by buildtool and ant-current-bin for Modified
    SAP Internet Sales Web Applications but i have war file and sda file ,i build form ISA_BuildTool_10 guidline document , build failed because Target 'sda.icssb2b' does not exist in this project.
    I think 'sda.icssb2b' was generated by earbuilder.xml
    please help me
    thanks you
    Soothiluck Y.

    You gave a default target in the build.xml, and then didn't define the target.
    This is an Ant question. You're better off asking Ant questions on an Ant forum.

  • Can I use the Apple Discussion software?

    I have my own web server and I was looking for some good forum software. I usually use phpBB. However, I started dreaming of forum software that would be great and remembered how much I like the Apple Discussions forums.
    I am sure the answer is no, but it does not hurt to ask. Does Apple have any plans to make their forums software available for other people to use?
    If this is not the proper forum for this topic, I apologize. It did not seem to fit anywhere else.
    Thanks,
    Jonathan
    Dreaming of a MacBook Pro    

    I agree. I am never sure when to mark something as a question because it may be quick or it may be a hard one and trying to decide who gets credit for what comments seems like a lot more work than I am looking for usually.
    You had a definite Question. I do not see the confusion in marking it as such
    clearly you did, it certainly was not a statement. Others do the work to help.
    Deciding whom to reward and w/ what I think should be part of your work in return.
    Question
    n 1: an instance of questioning; "there was a question about my training"; "we made inquiries of all those who were present" [syn: inquiry, enquiry, query, interrogation] [ant: answer] 2: the subject matter at issue; "the question of disease merits serious discussion"; "under the head of minor Roman poets" [syn: head] 3: a sentence of inquiry that asks for a reply; "he asked a direct question"; "he had trouble phrasing his interrogations" [syn: interrogation, interrogative, interrogative sentence] 4: uncertainty about the truth or factuality of existence of something; "the dubiousness of his claim"; "there is no question about the validity of the enterprise" [syn: doubt, dubiousness, doubtfulness] 5: a formal proposal for action made to a deliberative assembly for discussion and vote; "he made a motion to adjourn"; "she called for the question" [syn: motion] 6: an informal reference to a marriage proposal; "he was ready to pop the question"
    Answer
    n 1: a statement (either spoken or written) that is made in reply to a question or request or criticism or accusation; "I waited several days for his answer"; "he wrote replies to several of his critics" [syn: reply, response] 2: a statement that solves a problem or explains how to solve the problem; "they were trying to find a peaceful solution"; "the answers were in the back of the book"; "he computed the result to four decimal places" [syn: solution, result, resolution, solvent] 3: the speech act of replying to a question [ant: question] 4: the principle pleading by the defendant in response to plaintiff's complaint; in criminal law it consists of the defendant's plea of `guilty' or `not guilty' (or nolo contendere); in civil law it must contain denials of all allegations in the plaintiff's complaint that the defendant hopes to controvert and it can contain affirmative defenses or counterclaims Source: WordNet ® 2.0, © 2003 Princeton University
    Source: Acronym Finder, © 1988-2004 Mountain Data Systems
    Source: On-line Medical Dictionary, © 1997-98 Academic Medical Publishing & CancerWEB
    Power PC G4 (3.3) ♥ iMac Flat Panel 10.3.9 & 15 Alum.PowerBook Tiger   Mac OS X (10.4.5)  

  • Posting here as noone on the javadoc forum...

    I would like to generate the javadoc for some packages only, I tried to put a list of packages in the packagenames parameter, but I have got the following message:
    .... build.xml:85: No source files and no packages have been specified.
    Here is my build script sample:
    <target name="javadoc" depends="setup-classpath">
    <javadoc
    packagenames="com.etil.sudetp.eap com.etil.sudetp.eap.message"
    source="${basedir}/src"
    sourcepath="${basedir}/src"
    destdir="${basedir}/doc"
    use="true"
    author="false"
    version="true"
    </target>
    Thanks for your help.

    nasch_ is right plus your usage of the source attribute is not correct.
    Please see the answers to your post in the Javadoc forum.
    You really should be a little bit more patient. Just because the Javadoc forum is rather low traffic, it does not mean that the chances for (good) answers increase when posting in a less appropriate, high-traffic forum ... and this is actually an ANT question and not a Javadoc question, so the best place to ask this would have been the ANT mailing list.

Maybe you are looking for

  • FTP'ing the BI Publisher report

    if i ftp'ing the report from BI Publisher will that report save in the Database? if i do the normal scheduling(to email's) of that report from publisher will that report first save in database then deliver to scheduling emails? Edited by: user1225547

  • Getting Rid of Standard Colored Links Around Image Links

    I have included several images on my CS4 Dreamweaver site that link to other pages, sites, etc. when clicked. An unexpected and annoying standard blue (active), purple (visited), etc. link border appears around the image when viewed in IE and AOL bro

  • Replacing H/Drive and installing OS 10.5.6

    I'm planing to replace Hard drive and install Leopard 10.5.6, in same time. Is anybody has good tips for me on this project? My victim is; iMac G5 (iSight), 2.5 GB of Memory 2.1GHz 20-inch, S#; W8551*TAR, M#; ML064LL/A. New H/Drive; Western Digital C

  • ICal not accessing the correct address for an attendee

    Hi all, I am entering attendees to an event I created. I have checked in my Address Book and both attendees exist. However, both point to wrong people in my Address Book. For example, both attendees point to another person with the same first name in

  • Accordian Content Panel all opened in IE7

    I have developed a nice little accordian using Spry, but in IE7 all the panels are stretched open instead of just having the top one opened. It works in all other browsers except for IE7. Has anybody else had this problem? I can't find any solutions