geirm 01/08/21 04:33:16
Modified: jjar/examples/ant-task build.xml
Log:
A little cleanup, and added new target to test fetch/set-classpath
functionality (see test-classpath target....)
Revision Changes Path
1.3 +60 -10 jakarta-commons-sandbox/jjar/examples/ant-task/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jjar/examples/ant-task/build.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.xml 2001/08/08 10:57:46 1.2
+++ build.xml 2001/08/21 11:33:16 1.3
@@ -1,26 +1,46 @@
-
<project name="JJARTest" default="help" basedir=".">
+
+<!-- -->
+<!-- ant-build : JJAR examples -->
+<!-- -->
+<!-- These are simple examples of how to use JJAR -->
+<!-- with Jakarta Ant. For more information, see -->
+<!-- the JJAR project documentation -->
+
+<!--
+ $Id: build.xml,v 1.3 2001/08/21 11:33:16 geirm Exp $
+-->
+
+<!-- ============= initialize properties ===================== -->
- <property name="repository" value="repository" />
+ <!-- this is our local repository where jars are stored -->
+ <property name="rep.local" value="repository" />
- <!-- define the jjar target -->
+ <!-- where source is kept for test-classpath -->
+ <property name="src.dir" value="src" />
- <taskdef name="jjar"
- classname="org.apache.commons.jjar.JJARTask">
+<!-- ============= task definitions ========================== -->
+
+ <taskdef name="jjar" classname="org.apache.commons.jjar.JJARTask">
<classpath>
<pathelement location="jjar.jar"/>
</classpath>
</taskdef>
+
+<!-- ============= example targets =========================== -->
- <!-- simple test : get velocity - has a few dependencies -->
+ <!-- simple test : get the Velocity package - has a few dependencies -->
<target name="test" depends="testsimple, testverify">
</target>
<target name="testsimple">
- <jjar package="ant" localrepository="${repository}" />
+ <jjar package="jakarta-velocity"
+ version="1.2-dev"
+ localrepository="${rep.local}">
+ </jjar>
</target>
@@ -30,8 +50,10 @@
Adding jars in repository to classpath to test if they are skipped.
</echo>
- <jjar package="velocity" verifyignore="true" localrepository="${repository}" >
-
+ <jjar package="jakarta-velocity"
+ version="1.2-dev"
+ verifyignore="true"
+ localrepository="${rep.local}" >
</jjar>
</target>
@@ -39,7 +61,34 @@
<!-- another simple test : just get the dependencies of ant (has deps...) -->
<target name="test-nodeps">
- <jjar package = "ant" onlydependencies="true" localrepository="${repository}"
/>
+ <jjar package = "ant" onlydependencies="true" localrepository="${rep.local}" />
+ </target>
+
+
+ <!-- test-classpath : see if jjar can get the jars, add to -->
+ <!-- classpath, and successfully build -->
+
+ <target name="test-classpath">
+
+ <!-- use JJAR to fetch the Velocity package and -->
+ <!-- dependencies, placing in the repository -->
+
+ <jjar package="jakarta-velocity"
+ version="1.2-dev"
+ pathrefid="jjarclasspath"
+ localrepository="${rep.local}">
+ </jjar>
+
+ <!-- lets see if that worked -->
+ <property name="jjarpath" refid="jjarclasspath"/>
+ <echo message="jjarclasspath: ${jjarpath}"/>
+
+ <!-- now compile the test file, using the jjar classpath -->
+ <javac srcdir="${src.dir}"
+ destdir="." >
+ <classpath refid="jjarclasspath"/>
+ </javac>
+
</target>
<!-- help info -->
@@ -49,6 +98,7 @@
Current test targets :
test : fetches ant, which has dependencies, and velocity, which doesn't
test-nodeps : fetches only the dependencies of ant
+ test-classpath : fetches jars, adds to classpath, and compiles code
</echo>
</target>