ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad G. Kyer" <bgk...@yahoo.com>
Subject Re: My Classpath Should be Separate From Ant's
Date Thu, 05 May 2005 02:10:55 GMT

Actually, it's very easy to supply a different classpath to javac
(check the ant docs for more options)...

in your build.xml file

  <path id="my.project.classpath">
      <!-- get jars -->
      <fileset dir="C:/work/foo/jars">
         <include name="**/*.jar" />
         <!-- etc -->
      </fileset>
   </path>


in your compilation task

    <javac     srcdir="${src.dir}"
               destdir="${build.dir}"
               debug="on"
               deprecation="on">
    <!-- etc -->

    <!-- use the classpath we defined above -->
    <classpath refid="my.project.classpath"/>

    </javac>

-B


--- Bob Bronson <rbronson1976@yahoo.com> wrote:
> Hi All,
> 
> I tracked down a problem I'm having to the fact that when Ant compiles 
> my code (using the <javac> task), it uses the "Ant execution 
> classpath". What I'm saying is that the same classpath Ant sets up for 
> itself in order to run is also used as the classpath when compiling 
> *my* code.
> 
> In the <javac> task, set the "verbose" attribute to "yes" and you will 
> see tons of Ant-supplied JARs. I don't want to go into too many details 
> except to say that it causes versioning problems when my code is 
> compiled against those JARs and then run against different JARs.
> 
> I was hoping to tell the <javac> task something like, "compile my code 
> against these JARs AND THESE JARS ONLY. Do not consider the JARs needed 
> by Ant as part of my classpath".
> 
> I hope this is making sense. Is there a way to specify this?
> 
> Thanks very much.
> 
> Bob
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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