ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: How to figure out what is in my class path?
Date Mon, 24 Nov 2008 19:20:11 GMT
My mistake. I realized it as soon as I was writing a build.xml to test it:

Use:

<property name="project.class.path.property" refid="project.class.path"/>

and not

<property name="project.class.path.property" id="project.class.path"/>

Notice: It is suppose to be "refid" and not simply "id". When you use
"id", you are setting an "id". When you are using "refid", you are
referring to a previously set id.

Here's my test:

<project name="test" default="test" basedir=".">
    <target name="test">
        <path id="project.class.path">
            <fileset dir="jardir">
                <include name="*.jar"/>
            </fileset>
            <pathelement location="test/one/one.jar"/>
            <pathelement location="test/two/two.jar"/>
        </path>
        <property name="project.class.path.property"
refid="project.class.path"/>
        <echo>PATH = "${project.class.path.property}"</echo>
        <echo message="Setting path"/>
    </target>
</project>

(I created three jar files in the jardir directory called one.jar,
two.jar, three.jar)

Here's the output:

test:
     [echo] PATH =
"/solbright/tools/build/temp/jardir/one.jar:/solbright/tools/build/temp/jardir/three.jar:/solbright/tools/build/temp/jardir/two.jar:/solbright/tools/build/temp/test/one/one.jar:/solbright/tools/build/temp/test/two/two.jar"
     [echo] Setting path

All five jar files show up in my classpath

--
David Weintraub
qazwart@gmail.com



On Mon, Nov 24, 2008 at 1:37 PM,  <dave.alvarado@remanresource.com> wrote:
> Hi David,
>
>  <target name="check-junit" unless="isJUnitAvailable">
> <fail>DEBUG: project.class.path.property =
> "${project.class.path}"</fail>
>    <fail message="Failed: JUnit not in classpath"/>
>  </target>
>
> I followed your suggestion, only I put the FAIL statement in the target being executed
...
>
> but what is printed out on the screen is
>
> /export/third-party/etsbea/staging/wls_9.2.2/CedarPoint_Service/ant-common-checks.xml:41:
DEBUG: project.class.path.property =
> "${project.class.path}"
>
> Am I using the right syntax for printing this out?  Why isn't evaluating what is in the
{}'s?
>
> Thanks, - Dave
>
>
>>  -------Original Message-------
>>  From: David Weintraub <qazwart@gmail.com>
>>  Subject: Re: How to figure out what is in my class path?
>>  Sent: Nov 24 '08 18:11
>>
>>  Try printing out project.class.path right after you define it:
>>
>>  <property name="project.class.path.property" id="project.class.path"/>
>>
>>  <fail>DEBUG: project.class.path.property =
>>  "${project.class.path.property}"</fail>
>>
>>  The <fail> will stop the build from progressing, so you can see the
>>  classpath. You could use <echo> instead if you prefer.
>>  --
>>  David Weintraub
>>  qazwart@gmail.com
>>
>>
>>
>>  On Mon, Nov 24, 2008 at 1:03 PM,  <dave.alvarado@remanresource.com> wrote:
>>  > I tried your suggestion, but no luck.  I think I'm not including my classpath
correctly in my build-junit-test.xml script.  I have ...
>>  >
>>  > <project name="JUnitTests" default="run-all-tests" basedir=".">
>>  >  <import file="ant-common-checks.xml"/>
>>  >  <import file="build.xml"/>
>>  >  <property name="junitsrc" location="unittest"/>
>>  >  <property name="conf"  location="conf"/>
>>  >  <target name="build-tests" depends="check-junit">
>>  >
>>  > and within "build.xml" I define what you suggest ...
>>  >
>>  >  <path id="project.class.path">
>>  >        <fileset dir="${deployment}/APP-INF/lib/">
>>  >                <include name="*.jar"/>
>>  >        </fileset>
>>  >        <pathelement location="${weblogic-jar-path}"/>
>>  >        <pathelement location="${deployment}/APP-INF/lib/junit.jar"/>
>>  >  </path>
>>  >
>>  > But how does my "" script understand to use the project.class.path as its classpath?
>>  >
>>  >  - Dave
>>  >
>>  >
>>  >>  -------Original Message-------
>>  >>  From: Marc Weber <marco-oweber@gmx.de>
>>  >>  Subject: Re: How to figure out what is in my class path?
>>  >>  Sent: Nov 24 '08 16:56
>>  >>
>>  >>  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
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > 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
>>
>>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message