ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: AW: AW: project dependency
Date Tue, 07 Oct 2003 15:05:51 GMT
At 04:05 PM 10/7/2003 +0200, you wrote:
>I have tried using maven at home (where I don`t have internet) and it`s 
>very difficult te set up because the package you download doesn`t contain 
>everything. And I would like to continue to use ANT because I know it, and 
>apart from the dependencies, it has everything I need.

I solve the dependency issue in Ant using some hints from Tomcat's 
build.  For an example, see the build I wrote for the Prevayler project 
(for now it is at SourceForge, but it will be moving to Codehaus later this 
week)....
http://cvs.sourceforge.net/viewcvs.py/prevayler/prevayler/

Here is how it basically works....

1.  Define a dependency in build.properties:

# ----- Skaringa -----
skaringa.version=r2p3
skaringa.home=${dependencies.path}/skaringa
skaringa.jar=${skaringa.home}/lib/skaringa-${skaringa.version}.jar
skaringa.loc=http://umn.dl.sourceforge.net/sourceforge/skaringa/skaringa-${skaringa.version}.tar.gz

2.  Add any jar file dependencies to a path to be used as a classpath ref 
throughout the build:

<path id="build.classpath" >
         <pathelement location="${skaringa.jar}"/>
</path>

3.  Add an entity include in your build.xml pointing to 
utility-targets.incl.  This contains the reusable targets that you can take 
advantage of in your build.xml.  Then add a download target for grabbing 
your dependency:

<target name="download.dependencies.core"
             description="Download binary packages needed by the core 
packages" >
         <!-- Download any sub package or tools needed. -->
         <antcall target="-downloadgz">
             <param name="sourcefile" value="${skaringa.loc}"/>
             <param name="destfile"   value="${skaringa.jar}"/>
         </antcall>
</target>

Available reusable download targets are "-downloadgz", "-downloadzip", and 
"-downloadfile".

4.  Add the target "download.dependencies.core" (or whatever you name it) 
as a dependency for a compile (or other) target that requires the library 
you have specified.

Jar files will be checked for existence before attempting a download which 
keeps jar from being downloaded every time.  Note that the path to the jar 
file for any particular library will depend on the internal directory 
organization of the archive containing the jar.  Make sure to pay attention 
to this when you define your dependencies in build.properties.  Also note 
that the utility-targets.incl assumes that you have defined a dependency in 
your build.properties for ant-contrib.  Again, see the Prevayler 
sample.build.properties, utility-targets.incl, and build.xml for a working 
example of all this.

Jake 


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


Mime
View raw message