ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Janon <fja...@yahoo.com>
Subject Re: How to display the classpath that Ant is using to launch the java task?
Date Tue, 04 Mar 2008 00:09:27 GMT
Hi Garrett,

Thanks for the answer, the TopAntTips got the ansmwer for my problem.

Following up on my ant java target question, the "fork" option for
those who use ant to run java apps seem to be important when specifying
the classpath:

with fork='true' in the java target, here is the classpath as seen from
the app, it is the one from "app.classpath" in the build file as
desired:

     [java]
C:\Groovy-1.5.4\embeddable\groovy-all-1.5.4.jar;C:\Groovy_JPADownstream\classes;C:\Groovy_JPADownstream\lib\derby.jar;C:\Groovy_JPADownstr
eam\lib\derbyclient.jar;C:\Groovy_JPADownstream\lib\toplink-essentials-agent.jar;C:\Groovy_JPADownstream\lib\toplink-essentials.jar;C:\Groovy_JPADowns
tream\config

  <target name = "run" depends = "compile">
  <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise the
classpath of the application is the one from ant and JPA doesn't find
the persistence.xml file -->
    <java classname = "downstream.PopulateDownstream" fork="true">
        <classpath refid = "app.classpath"/>
    </java>
  </target>

with fork='false' in the java target. it is the one for "ant", not much
to do with the one specified in "app.classpath" in the build file:

     [java]
C:\ant-1.7.0\lib\ant-launcher.jar;C:\Groovy_JPADownstream\.;C:\Program
Files\Java\jre1.6.0_02\lib\ext\QTJava.zip;C:\ant-1.7.0\lib\ant-antl
r.jar;C:\ant-1.7.0\lib\ant-apache-bcel.jar;C:\ant-1.7.0\lib\ant-apache-bsf.jar;C:\ant-1.7.0\lib\ant-apache-log4j.jar;C:\ant-1.7.0\lib\ant-apache-oro.j
ar;C:\ant-1.7.0\lib\ant-apache-regexp.jar;C:\ant-1.7.0\lib\ant-apache-resolver.jar;C:\ant-1.7.0\lib\ant-commons-logging.jar;C:\ant-1.7.0\lib\ant-commo
ns-net.jar;C:\ant-1.7.0\lib\ant-jai.jar;C:\ant-1.7.0\lib\ant-javamail.jar;C:\ant-1.7.0\lib\ant-jdepend.jar;C:\ant-1.7.0\lib\ant-jmf.jar;C:\ant-1.7.0\l
ib\ant-jsch.jar;C:\ant-1.7.0\lib\ant-junit.jar;C:\ant-1.7.0\lib\ant-launcher.jar;C:\ant-1.7.0\lib\ant-netrexx.jar;C:\ant-1.7.0\lib\ant-nodeps.jar;C:\a
nt-1.7.0\lib\ant-starteam.jar;C:\ant-1.7.0\lib\ant-stylebook.jar;C:\ant-1.7.0\lib\ant-swing.jar;C:\ant-1.7.0\lib\ant-testutil.jar;C:\ant-1.7.0\lib\ant
-trax.jar;C:\ant-1.7.0\lib\ant-weblogic.jar;C:\ant-1.7.0\lib\ant.jar;C:\ant-1.7.0\lib\junit.jar;C:\ant-1.7.0\lib\xercesImpl.jar;C:\ant-1.7.0\lib\xml-a
pis.jar;C:\jdk1.6.0_02\lib\tools.jar

  <target name = "run" depends = "compile">
  <!-- CAUTION: MUST have the 'fork="true"' attribute, otherwise the
classpath of the application is the one from ant and JPA doesn't find
the persistence.xml file -->
    <java classname = "downstream.PopulateDownstream" fork="false">
        <classpath refid = "app.classpath"/>
    </java>
  </target>

I don't really understand why for='true' is not the default for the
java target in ant but that's how it is.

Conclusion: make sure that 'fork="true"' is set on a java target in Ant
is you want to use your own classpath and not the Ant one.

Fred

--- Garrett Smith <dhtmlkitchen@gmail.com> wrote:

> On Tue, Feb 26, 2008 at 6:38 PM, Fred Janon <fjanon@yahoo.com> wrote:
> > Is there anything to display the classpath that Ant is using to
> launch
> >  a java task besides the verbose and debug ant options that don't
> >  display it?
> >
> This might not be the answer to what you want to do, but...
> 
> Ant should be using PATH, variable.
> 
> Are you using Windows? If so...
> Start -> Control Panel...
> Double click on "System"...
> In the System Properties, choose "Advanced" tab.
> Click "Environment Variables" button
> set system properties.
> 
> If JAVA_HOME is in "Program Files", change that to
> C:\Progra~1\Java\...
> 
> I know it's not exactly what you asked, but thought it might help
> anyway.
> 
> This might help, too:
> http://www.catalysoft.com/articles/TopAntTips.html
> 
> Garrett
> 
> >  How can I debug Ant file in general? I check the Ant manual left
> and
> >  right and didn't find anything.
> >
> >  Thanks
> >
> >  Fred
> >
> >
> > 
> ---------------------------------------------------------------------
> >  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