I'm forwarding this to the list.
You have to "Reply All" to send to the list and the individual users.
--
David Weintraub
[EMAIL PROTECTED]
---------- Forwarded message ----------
From: <[EMAIL PROTECTED]>
Date: Tue, Nov 25, 2008 at 3:24 PM
Subject: Re: Re: How to figure out what is in my class path?
To: David Weintraub <[EMAIL PROTECTED]>
Is there a way to print out what is in the Ant classpath? I've tried
putting ant-junit.jar and junit.jar in both the ANT_HOME/lib directory
and my HOME/.ant/lib directories but no luck. For those just tuning
in, here is the task that is failing
<target name="run-query-test" depends="build-tests">
<echo>DEBUG: ${build}</echo>
<junit dir="${build}" fork="true" haltonfailure="true">
<classpath>
<path refid="project.class.path"/>
<pathelement path="${java.class.path}"/>
<pathelement path="${dist}/cedarpointpooledclient.jar"/>
<pathelement path="${build}"/>
</classpath>
<test name="QuerySubscriberTest" todir="${docs}"
outfile="junit.query.result">
<formatter type="xml"/>
</test>
</junit>
</target>
If you can think of an alternate way of writing the above, I'm willing
to try anything. Thanks, -Dave
> -------Original Message-------
> From: David Weintraub <[EMAIL PROTECTED]>
> Subject: Re: Re: How to figure out what is in my class path?
> Sent: Nov 25 '08 19:46
>
> I think the POM is needed in order to understand the JUnit ant task
> without having to define it in the antfile. I know I have to have a
> <taskdef> task whenever I use Subverison or the AntContrib package. I
> know that I don't need one for JUnit.
>
> Maybe you don't need the POM for JUnit. It isn't specified in the
> JUnit task documentation.
>
> Remember there are three different classpaths involved. #1 is the
> classpath that <javac>, <java>, or whatever task your running needs.
> The second one is the one that the Java you're running Ant with needs.
> And, the third is the Ant classpath needed for the various tasks you
> need for Ant.
> In order to use the JUnit task, the ant-junit.jar needs to be in Ant's
> classpath. If you put it in $ANT_HOME/lib, it is automatically
> included. However, you can use the -lib parameter when you run Ant, or
> include it in your $HOME/.ant/lib forlder. See
> <http://ant.apache.org/manual/running.html#libs> for more information.
>
> --
> David Weintraub
> [EMAIL PROTECTED]
>
>
>
> On Tue, Nov 25, 2008 at 1:28 PM, <[EMAIL PROTECTED]> wrote:
> > This is the first I've heard about a "ant-junit-xx.pom" file. So it's
> impossible to run junit without this file? Needless to say, I tried adding
> the ant-junit.jar and junit.jar files to the junit <classpath> directive
> without success ...
> >
> > <target name="run-query-test" depends="build-tests">
> > <echo>DEBUG: ${deployment}/APP-INF/lib/junit.jar</echo>
> > <junit dir="${build}" fork="true" haltonfailure="true">
> > <classpath>
> > <path refid="project.class.path"/>
> > <pathelement
> path="${deployment}/APP-INF/lib/junit.jar"/>
> > <pathelement
> pathu="${deployment}/APP-INF/lib/ant-junit.jar"/>
> > <pathelement path="${java.class.path}"/>
> > <pathelement
> path="${dist}/cedarpointpooledclient.jar"/>
> > <pathelement path="${build}"/>
> > </classpath>
> > <test name="QuerySubscriberTest" todir="${docs}"
> outfile="junit.query.result">
> > <formatter type="xml"/>
> > </test>
> > </junit>
> > </target>
> >
> > I can't easily add files to ANT_HOME/lib and so was hoping I could include
> the JAR files elsewhere. - Dave
> >
> >
> >
> >> -------Original Message-------
> >> From: David Weintraub <[EMAIL PROTECTED]>
> >> Subject: Re: Re: How to figure out what is in my class path?
> >> Sent: Nov 25 '08 17:22
> >>
> >> You know that the JUnit's task is an *optional* task. You need to
> >> include the ant-junit.jar in your $ANT_HOME/lib directory as well as
> >> with the ant-junit-xx.pom file. I don't believe you have to define the
> >> JUnit tasks in your build.xml file because it can use the *.pom for
> >> the definition.
> >>
> >> See <http://ant.apache.org/manual/OptionalTasks/junit.html> for more
> >> information.
> >>
> >> --
> >> David Weintraub
> >> [EMAIL PROTECTED]
> >>
> >>
> >>
> >> On Tue, Nov 25, 2008 at 10:01 AM, <[EMAIL PROTECTED]> wrote:
> >> > Thanks! Adding 'classpathref="project.class.path"' to the condition
> caused the condition to pass.
> >> >
> >> > I have hit another stumbling block ater, though. The build script
> being executed dies when it gets to this task:
> >> >
> >> > <target name="run-change-display-name-test" depends="build-tests">
> >> > <junit dir="${build}" fork="true" haltonfailure="true">
> >> > <classpath>
> >> > <path refid="project.class.path"/>
> >> > <path refid="${deployment}/APP-INF/lib/junit.jar"/>
> >> > <pathelement path="${java.class.path}"/>
> >> > <pathelement path="${dist}/cedarpointpooledclient.jar"/>
> >> > <pathelement path="${build}"/>
> >> > </classpath>
> >> > <test name="ChangeDisplayNameTest" todir="${docs}"
> outfile="junit.change.display.name.result">
> >> > <formatter type="xml"/>
> >> > </test>
> >> > </junit>
> >> > </target>
> >> >
> >> > with the error message,
> >> >
> >> > BUILD FAILED
> >> >
> /export/third-party/etsbea/staging/wls_9.2.2/CedarPoint_Service/build-junit-test.xml:119:
> Could not create task or type of type: junit.
> >> >
> >> > Ant could not find the task or a class this task relies upon.
> >> >
> >> > This is common and has a number of causes; the usual
> >> > solutions are to read the manual pages then download and
> >> > install needed JAR files, or fix the build file:
> >> > - You have misspelt 'junit'.
> >> > Fix: check your spelling.
> >> > - The task needs an external JAR file to execute
> >> > and this is not found at the right place in the classpath.
> >> > Fix: check the documentation for dependencies.
> >> > Fix: declare the task.
> >> > - The task is an Ant optional task and the JAR file and/or libraries
> >> > implementing the functionality were not found at the time you
> >> > yourself built your installation of Ant from the Ant sources.
> >> > Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
> >> > task and make sure it contains more than merely a
> META-INF/MANIFEST.MF.
> >> > If all it contains is the manifest, then rebuild Ant with the
> needed
> >> > libraries present in ${ant.home}/lib/optional/ , or alternatively,
> >> > download a pre-built release version from apache.org
> >> > - The build file was written for a later version of Ant
> >> > Fix: upgrade to at least the latest release version of Ant
> >> > - The task is not an Ant core or optional task
> >> > and needs to be declared using <taskdef>.
> >> > - You are attempting to use a task defined using
> >> > <presetdef> or <macrodef> but have spelt wrong or not
> >> > defined it at the point of use
> >> >
> >> > Remember that for JAR files to be visible to Ant tasks implemented
> >> > in ANT_HOME/lib, the files must be in the same directory or on the
> >> > classpath
> >> >
> >> >
> >> > I have listed both '<path refid="project.class.path"/>' and '<path
> refid="${deployment}/APP-INF/lib/junit.jar"/>' in the <classpath>. Am I not
> doing it right?
> >> >
> >> > Thanks, - Dave
> >> >
> >> >
> >> >
> >> >
> >> >> -------Original Message-------
> >> >> From: [EMAIL PROTECTED]
> >> >> Subject: Re: Re: How to figure out what is in my class path?
> >> >> Sent: Nov 25 '08 04:03
> >> >>
> >> >> On Nov 24, 2008 3:01pm, [EMAIL PROTECTED] wrote:
> >> >> > Thanks, that worked, the path prints out.
> >> >> >
> >> >> >
> >> >> >
> >> >> > Now the real question. � I have confirmed that "junit.jar" is in my
> >> >> project.class.path, but the condition that checks for JUnit is still
> >> >> failing
> >> >>
> >> >> We know that your classpath in project.class.path is getting set.
> >> >> Let's look at how you use the <available> task:
> >> >>
> >> >> <condition property="isJUnitAvailable">
> >> >> <available classname="junit.framework.TestCase"/>
> >> >> </condition>
> >> >>
> >> >> How does <available> know which classpath to use? According to the
> >> >> documentation on the <available> task, if you don't specify which
> >> >> classpath to use, it will use Ant's default classpath. Try
> referencing
> >> >> the classpath that contains the JUnit class in the <available> task:
> >> >>
> >> >> <available property="isJUnitAvailable"
> >> >> classname="junit.framework.TestCase"
> >> >> classpathref="project.class.path"/>
> >> >>
> >> >> Or (using the <condition> task):
> >> >>
> >> >> <condition property="isJUnitAvailable">
> >> >> <available classname="junit.framework.TestCase"
> >> >> classpathref="project.class.path"/>
> >> >> </condition>
> >> >>
> >> >> That way, you're saying to look for the classname in your
> >> >> "project.class.path".
> >> >
> >>
> >
>