You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by da...@remanresource.com on 2008/11/24 17:40:19 UTC

How to figure out what is in my class path?

Hi,

Is there a way to see what ANT thinks is in my classpath?  I have a condition that's failing

  <condition property="isJUnitAvailable">
    <available classname="junit.framework.TestCase"/>
  </condition>

  <target name="check-junit" unless="isJUnitAvailable">
    <fail message="Failed: JUnit not in classpath"/>
  </target>

But the JAR file (junit.jar) is set up in my project.class.path ...

  <path id="project.class.path">
        <fileset dir="${deployment}/APP-INF/lib/">
                <include name="*.jar"/>
        </fileset>
        <pathelement location="${weblogic-jar-path}"/>
  </path>

Not quite sure the right way to debug this.  Thanks, - Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How to figure out what is in my class path?

Posted by Peter Reilly <pe...@gmail.com>.
With current ant tasks, one cannot change the classpath used within build.xml.

For junit and ant 1.7.0 +, one can set the location of the junit.jar
file within the <junit>
task itself - this is indeed the recommended way as it means that one
does not need to modify the ant distribution or use -lib at the command line.


<junit ...>
   <classpath>
        <path refid="location junit.jar"/>
       ....
   </classpath>
</junit>

Peter


On Mon, Nov 24, 2008 at 4:40 PM,  <da...@remanresource.com> wrote:
> Hi,
>
> Is there a way to see what ANT thinks is in my classpath?  I have a condition that's failing
>
>  <condition property="isJUnitAvailable">
>    <available classname="junit.framework.TestCase"/>
>  </condition>
>
>  <target name="check-junit" unless="isJUnitAvailable">
>    <fail message="Failed: JUnit not in classpath"/>
>  </target>
>
> But the JAR file (junit.jar) is set up in my project.class.path ...
>
>  <path id="project.class.path">
>        <fileset dir="${deployment}/APP-INF/lib/">
>                <include name="*.jar"/>
>        </fileset>
>        <pathelement location="${weblogic-jar-path}"/>
>  </path>
>
> Not quite sure the right way to debug this.  Thanks, - Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How to figure out what is in my class path?

Posted by Marc Weber <ma...@gmx.de>.
On Mon, Nov 24, 2008 at 04:40:19PM +0000, dave.alvarado@remanresource.com wrote:
> Hi,
> 
> Is there a way to see what ANT thinks is in my classpath?  I have a condition that's failing
> 
>   <condition property="isJUnitAvailable">
>     <available classname="junit.framework.TestCase"/>
>   </condition>
> 
>   <target name="check-junit" unless="isJUnitAvailable">
>     <fail message="Failed: JUnit not in classpath"/>
>   </target>
> 
> But the JAR file (junit.jar) is set up in my project.class.path ...
> 
>   <path id="project.class.path">
>         <fileset dir="${deployment}/APP-INF/lib/">
>                 <include name="*.jar"/>
>         </fileset>
>         <pathelement location="${weblogic-jar-path}"/>
>   </path>
> 
> Not quite sure the right way to debug this.  Thanks, - Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

That's a bug I've posted some days ago. The solution is to add the
classpath in the build.xml file manually after (after <path id="classpath">)
    <pathelement location="${junit}/junit.jar"/>

${junit}/junit.jar is your junit.jar file

sed command:
sed -i 's@<path id="classpath">@<path id="classpath"><pathelement location="${junit}/junit.jar"/>@' build.xml


Hopefully someone with more knowledge about the ant build system can add
a one line fix so that this can be configured by -D or by
bulid.properties.

If you want I can prepare a patch. Just tell me to do so.

Anyway I wonder how ant devs do compile ant?

Sincerly
Marc Weber

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org