ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <jakarta-...@ehatchersolutions.com>
Subject Re: Adding a directory of jars to the classpath
Date Thu, 05 Sep 2002 15:08:57 GMT
I highly discourage the **/*.jar inclusion of JAR's into a classpath. 
This leaves it too open-ended to have the build broken later by someone 
introducing a conflicting JAR at a later time and this can be time 
consuming and painful to track down.

Alternatively, there is an approach that I've evolved over time using a 
lib.properties to contain properties for library version numbers, 
directory mappings, and JAR location mappings that can allow great 
flexibility and control classpaths and overriding what version of 
library is used.

This is documented chapter 9 of Java Development with Ant 
(Loughran/Hatcher).

	Erik


Kervin, Stephen wrote:
> Cant think of a better way off hand. Looks good. 
> 
> Stephen
> 
> -----Original Message-----
> From: Joe Tomcat [mailto:tomcat@mobile.mp]
> Sent: 05 September 2002 10:16
> To: Ant Users List
> Subject: RE: Adding a directory of jars to the classpath
> 
> 
> On Wed, 2002-09-04 at 23:02, Kervin, Stephen wrote:
> 
>>We use a "lib" folder. But unfortunatly you still need to specify each jar
>>seperataly on the class path, I have not seen a way to java to recursive a
>>directory looking for jars. I tend to use a classpath from a
>>paths.properties file this way it is easily configurable and updateable. 
> 
> 
> This is what I'm using for now:
> 
>   <target name="compile" depends="prepare" description="Compiles all
> source code.">
>     <javac srcdir="${src.dir}" destdir="${build.classes}"
> excludes="**/old/*">
>       <classpath>
>         <fileset dir="${applibs}">
> 	  <include name="**/*.jar"/>
> 	</fileset>
>       </classpath>
>     </javarc>
>   </target>
> 
> It grabs all the jars in ${applibs}.  I can then set up my deploy target
> to copy those jars over to webapps/ROOT/WEB-INF/libs if they change and
> I should be set, right?  Is this the best way to do this?
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> 



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


Mime
View raw message