dportabella
asked on
How to get the classpath from ant build file
I have a ant build file as follows:
+++++++++++
<project name="test" basedir=".">
<property name="lib.dir" value="/data/java_library/ ext"/>
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
</project>
++++++++++++
I would to run something like:
MYCLASSPATH=`ant -q cp`
which should set the environment variable MYCLASSPATH to whatever is defined in the ant build file.
how can I do that?
DAvid
+++++++++++
<project name="test" basedir=".">
<property name="lib.dir" value="/data/java_library/
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
</project>
++++++++++++
I would to run something like:
MYCLASSPATH=`ant -q cp`
which should set the environment variable MYCLASSPATH to whatever is defined in the ant build file.
how can I do that?
DAvid
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)
You might find it more convenient to do
You might find it more convenient to do
<property name="cp" refid="project.classpath" />
<echo message="${cp}" file="cp.txt" />
ASKER
Thanks!
DAvid
DAvid
And of course you could always print it from your app ;-)
ASKER
Thanks CEHJ.
If someone is interested, add this to the build.xml
++++++++
<property name="cp" refid="project.classpath" />
<target name="cp" description="Shows the classpath">
<echo message="${cp}"/>
</target>
++++++++
And then execute:
MYCLASSPATH=`ant -q cp | sed -n -e "s/ \[echo\] //p"`
DAvid