Taking what Aiden suggested. Here is a first cut at ivy integration. What this does is:

1) Require that every module have an ivy.xml file which is contains all the dependencies. 2) Defines a depVersions.properties file at the root project to control the actual version numbers.
3) Builds a pom file (DRY) with every build (see build/pom).

What this does not do is:

A) Use the local lib file. If the requirement is to check in every version, we could do that by refactoring the lib directory to be a mini ivy or maven repo.

Can folks please take a look at this patch and let me know what it misses from your requirements. To install it, please do the following:

I) Grab the latest from the repo.
II) Apply this patch from the first qpid directory.
III) Download the ivy 2.1.0rc1 jar from http://ant.apache.org/ivy/download.cgi and put it into the lib directory. IV) From the java/common directory do an ant build. Inspect the ivy.xml file that is there. Also look at build/pom/qpid-common-0.5.pom V) from the java/client directory do an ant build. Inspect the ivy.xml file and pom file. Note that this relies on qpid-common.
VI) Scan the rest of the files.. and ask any questions.

Thanks!

-- bk



diff --git a/qpid/java/client/ivy.xml b/qpid/java/client/ivy.xml
new file mode 100644
index 0000000..daad1ce
--- /dev/null
+++ b/qpid/java/client/ivy.xml
@@ -0,0 +1,14 @@
+<ivy-module version="2.0">
+    <info organisation="org.apache.qpid" module="qpid-client" revision="${project.version}"/>
+    <configurations>
+        <conf name="provided" visibility="public" transitive="true" />    
+        <conf name="compile" extends="provided"/>
+        <conf name="test" extends="compile"  />
+    </configurations>
+    
+    <dependencies>
+        <dependency org="org.apache.qpid" name="qpid-common" rev="${project.version}" conf="compile->compile"/>
+        <dependency org="geronimo-spec" name="geronimo-spec-jms" rev="${geronimo-spec-jms.version}" conf="provided->default"/>
+    </dependencies>
+
+</ivy-module>
diff --git a/qpid/java/common.xml b/qpid/java/common.xml
index 511cdc6..073fbaf 100644
--- a/qpid/java/common.xml
+++ b/qpid/java/common.xml
@@ -18,7 +18,7 @@
  - under the License.
  -
  -->
-<project name="common">
+<project name="common" xmlns:ivy="antlib:org.apache.ivy.ant">
 
   <dirname property="project.root" file="${ant.file.common}"/>
 
@@ -31,6 +31,8 @@
   <property name="build.bin"             location="${build}/bin"/>
   <property name="build.etc"             location="${build}/etc"/>
   <property name="build.lib"             location="${build}/lib"/>
+  <property name="build.pom"             location="${build}/pom"/>  
+  <property name="build.repo"            location="${build}/repo"/>  
   <property name="build.results"         location="${build}/results"/>
   <property name="build.failed"          location="${build.results}/FAILED"/>
   <property name="build.report"          location="${build}/report"/>
@@ -113,6 +115,12 @@
   <taskdef name="foreach" classname="org.apache.qpid.tasks.Foreach"
            classpath="${tasks.classes}"/>
 
+  <taskdef resource="org/apache/ivy/ant/antlib.xml"
+         uri="antlib:org.apache.ivy.ant"
+         classpath="${project.root}/lib/ivy-2.1.0-rc1.jar"/>
+
+  <ivy:configure file="${project.root}/ivysettings.xml" />               
+
   <target name="clean-tasks">
     <delete dir="${tasks.classes}"/>
   </target>
diff --git a/qpid/java/common/ivy.xml b/qpid/java/common/ivy.xml
new file mode 100644
index 0000000..2b27532
--- /dev/null
+++ b/qpid/java/common/ivy.xml
@@ -0,0 +1,25 @@
+<ivy-module version="2.0">
+    <info organisation="org.apache.qpid" module="qpid-common" revision="${project.version}"/>
+    <configurations>
+        <conf name="provided" visibility="public" transitive="true" />    
+        <conf name="compile" extends="provided"/>
+        <conf name="test" extends="compile"  />
+    </configurations>
+    
+    <dependencies>
+        <dependency org="org.slf4j" name="slf4j-api" rev="${slf4j-api.version}" conf="compile->default"/>
+        <dependency org="backport-util-concurrent" name="backport-util-concurrent" rev="${backport-util-concurrent.version}" conf="compile->default"/>
+        <dependency org="org.apache.mina" name="mina-core" rev="${mina-core.version}" conf="compile->default"/>
+        <dependency org="org.apache.mina" name="mina-filter-ssl" rev="${mina-filter-ssl.version}" conf="compile->default"/>        
+        <dependency org="commons-beanutils" name="commons-beanutils-core" rev="${commons-beanutils-core.version}" conf="compile->default"/>
+        <dependency org="commons-digester" name="commons-digester" rev="${commons-digester.version}" conf="compile->default"/>
+        <dependency org="commons-codec" name="commons-codec" rev="${commons-codec.version}" conf="compile->default"/>
+        <dependency org="commons-lang" name="commons-lang" rev="${commons-lang.version}" conf="compile->default"/>
+        <dependency org="commons-collections" name="commons-collections" rev="${commons-collections.version}" conf="compile->default"/>
+        <dependency org="commons-configuration" name="commons-configuration" rev="${commons-configuration.version}" conf="compile->default"/>
+
+        <dependency org="org.slf4j" name="slf4j-log4j12" rev="${slf4j-log4j12.version}" conf="test->default"/>
+        <dependency org="junit" name="junit" rev="${junit.version}" conf="test->default"/>
+    </dependencies>
+
+</ivy-module>
diff --git a/qpid/java/depVersions.properties b/qpid/java/depVersions.properties
new file mode 100644
index 0000000..dace2f9
--- /dev/null
+++ b/qpid/java/depVersions.properties
@@ -0,0 +1,13 @@
+slf4j-api.version=1.4.0
+slf4j-log4j12.version=1.4.0
+backport-util-concurrent.version=2.2
+junit.version=3.8.1
+mina-core.version=1.0.1
+mina-filter-ssl.version=1.0.1
+commons-beanutils-core.version=1.8.0
+commons-digester.version=1.8.1
+commons-codec.version=1.3
+commons-lang.version=2.2
+commons-collections.version=3.2
+commons-configuration.version=1.6
+geronimo-spec-jms.version=1.0-M1
diff --git a/qpid/java/ivysettings.xml b/qpid/java/ivysettings.xml
new file mode 100644
index 0000000..1250e3f
--- /dev/null
+++ b/qpid/java/ivysettings.xml
@@ -0,0 +1,18 @@
+<ivysettings>
+        <properties file="./depVersions.properties" />
+        <property name="ivy.distrib.dir" value="${$build}/distrib"/>
+        <settings defaultResolver="resolverChain" checkUpToDate="true" />-->
+        <resolvers>
+                <!--<ibiblio name="ibiblio" />-->
+                <chain name="resolverChain">
+                    <filesystem name="local" m2compatible="true">
+                        <ivy pattern="${build.repo}/[module]/ivy-[revision].xml" />
+                        <artifact pattern="${build.repo}/[module]/[artifact]-[revision].[ext]" />                    
+                    </filesystem>                
+                    <url name="apacheMaven2" m2compatible="true">
+                      <artifact pattern="http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"; />
+                    </url>
+                    <ibiblio name="ibiblio"/>
+                </chain>
+        </resolvers>
+</ivysettings>
diff --git a/qpid/java/module.xml b/qpid/java/module.xml
index 42da1fe..28f068c 100644
--- a/qpid/java/module.xml
+++ b/qpid/java/module.xml
@@ -18,7 +18,7 @@
  - under the License.
  -
  -->
-<project name="module">
+<project name="module"  xmlns:ivy="antlib:org.apache.ivy.ant">
 
   <import file="common.xml"/>
 
@@ -38,6 +38,8 @@
 
   <property name="module.build"        location="${build}/${module}"/>
   <property name="module.classes"      location="${module.build}/classes"/>
+  <property name="module.lib"          location="${module.build}/lib"/>
+  <property name="module.test.lib"     location="${module.build}/testlib"/>    
   <property name="module.instrumented" location="${module.build}/classes-instrumented"/>
   <property name="module.precompiled"  location="${module.build}/src"/>
   <property name="module.api"          location="${module.build}/api"/>
@@ -68,60 +70,6 @@
   <available property="module.etc.exists" file="${module.etc}"/>
   <available property="module.bin.exists" file="${module.bin}"/>
 
-  <indirect name="module.libs"         variable="${module.name}.libs"/>
-  <indirect name="module.test.libs"    variable="${module.name}.test.libs"/>
-
-  <path id="module.libs">
-    <filelist dir="${project.root}" files="${module.libs}"/>
-  </path>
-
-  <path id="module.test.libs">
-    <filelist dir="${project.root}" files="${module.test.libs}"/>
-  </path>
-
-  <path id="module.src.path">
-    <pathelement location="${module.src}"/>
-    <pathelement location="${module.precompiled}"/>
-  </path>
-
-  <condition property="module.jar"
-             value="${build.plugins}/${project.name}-${module.name}-${project.version}.jar"
-             else="${build.lib}/${project.name}-${module.name}-${project.version}.jar">
-    <and>
-      <isset property="module.plugin"/>
-      <istrue value="${module.plugin}"/>
-    </and>
-  </condition>
-
-  <property name="module.test.jar"
-            location="${build.lib}/${project.name}-${module.name}-tests-${project.version}.jar"/>
-
-  <!-- module.depends and module.test.depends are supplied by the importing file -->
-  <property name="module.depends"       value=""/>
-  <property name="module.test.depends"  value=""/>
-  <property name="module.test.excludes" value=""/>
-
-  <map property="module.depends.path" value="${module.depends}" join="${path.separator}">
-    <globmapper from="*" to="${build}/*/classes"/>
-  </map>
-
-  <map property="module.test.depends.path" value="${module.test.depends}" join="${path.separator}">
-    <globmapper from="*" to="${build}/*/classes"/>
-  </map>
-
-  <path id="module.class.path">
-    <pathelement location="${module.classes}"/>
-    <pathelement path="${module.depends.path}"/>
-    <path refid="module.libs"/>
-  </path>
-
-  <path id="module.test.path">
-    <pathelement path="${module.test.classes}"/>
-    <path refid="module.class.path"/>
-    <pathelement path="${module.test.depends.path}"/>
-    <path refid="module.test.libs"/>
-  </path>
-
   <property name="javac.deprecation" value="off"/>
 
   <target name="debug">
@@ -145,6 +93,8 @@
     <mkdir dir="${build.bin}"/>
     <mkdir dir="${build.etc}"/>
     <mkdir dir="${build.lib}"/>
+    <mkdir dir="${build.repo}"/>
+    <mkdir dir="${build.pom}"/>        
     <mkdir dir="${build.results}"/>
     <mkdir dir="${build.data}"/>
     <mkdir dir="${build.plugins}"/>
@@ -153,6 +103,61 @@
     <mkdir dir="${module.api}"/>
     <mkdir dir="${module.test.classes}"/>
     <mkdir dir="${module.results}"/>
+
+   
+    <ivy:retrieve pattern="${module.lib}/[artifact]-[revision].[ext]" conf="compile"/>    
+    <path id="module.libs">
+      <fileset dir="${module.lib}" includes="*.jar"/>
+    </path>
+
+    <ivy:retrieve pattern="${module.test.lib}/[artifact]-[revision].[ext]" conf="test"/>    
+    <path id="module.test.libs">
+      <fileset dir="${module.test.lib}" includes="*.jar"/>
+    </path>
+
+    <path id="module.src.path">
+      <pathelement location="${module.src}"/>
+      <pathelement location="${module.precompiled}"/>
+    </path>
+
+    <condition property="module.jar"
+             value="${build.plugins}/${project.name}-${module.name}-${project.version}.jar"
+             else="${build.lib}/${project.name}-${module.name}-${project.version}.jar">
+    <and>
+      <isset property="module.plugin"/>
+      <istrue value="${module.plugin}"/>
+    </and>
+    </condition>
+
+    <property name="module.test.jar"
+            location="${build.lib}/${project.name}-${module.name}-tests-${project.version}.jar"/>
+
+    <!-- module.depends and module.test.depends are supplied by the importing file -->
+    <property name="module.depends"       value=""/>
+    <property name="module.test.depends"  value=""/>
+    <property name="module.test.excludes" value=""/>
+
+    <map property="module.depends.path" value="${module.depends}" join="${path.separator}">
+      <globmapper from="*" to="${build}/*/classes"/>
+    </map>
+
+    <map property="module.test.depends.path" value="${module.test.depends}" join="${path.separator}">
+      <globmapper from="*" to="${build}/*/classes"/>
+    </map>
+
+    <path id="module.class.path">
+        <pathelement location="${module.classes}"/>
+        <pathelement path="${module.depends.path}"/>
+        <path refid="module.libs"/>
+    </path>
+
+    <path id="module.test.path">
+        <pathelement path="${module.test.classes}"/>
+        <path refid="module.class.path"/>
+        <pathelement path="${module.test.depends.path}"/>
+        <path refid="module.test.libs"/>
+    </path>
+
   </target>
 
   <target name="precompile"/>
@@ -311,7 +316,18 @@
 
   <target name="postbuild" description="run after a build"/>
 
-  <target name="build" depends="jar,jar-tests,libs,copy-bin,copy-etc,postbuild" description="compile and copy resources into build tree"/>
+  <target name="deploy">
+    <ivy:publish resolver="local" forcedeliver="true" overwrite="true" artifactspattern="${build.lib}/[artifact]-[revision].[ext]"/>
+
+    <ivy:makepom ivyfile="ivy.xml" pomfile="${build.pom}/${module.namever}.pom">
+       <mapping conf="provided" scope="provided"/>
+       <mapping conf="compile" scope="compile"/>
+       <mapping conf="test" scope="test"/>       
+    </ivy:makepom>
+  </target>
+  
+
+  <target name="build" depends="jar,jar-tests,libs,copy-bin,copy-etc,postbuild,deploy" description="compile and copy resources into build tree"/>
   <target name="jar.manifest" depends="compile" if="module.manifest">
     <jar destfile="${module.jar}" basedir="${module.classes}" manifest="${module.manifest}"/>
   </target>
@@ -542,5 +558,10 @@
       <fileset dir="${module.src}" includes="**/*.java" />
     </cobertura-report>
   </target>
+
+  <target name="bk">
+    <ivy:retrieve pattern="${project.root}/lib2/[artifact]-[revision].[ext]"/>
+    <ivy:cachepath pathid="bk.classpath" />
+  </target>
   
 </project>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to