You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by st...@apache.org on 2005/11/18 13:39:26 UTC

svn commit: r345482 - /webservices/axis2/trunk/java/build.xml

Author: stevel
Date: Fri Nov 18 04:39:20 2005
New Revision: 345482

URL: http://svn.apache.org/viewcvs?rev=345482&view=rev
Log:
an ant build to not only run maven, but to copy the deployed artifacts to the local Maven2 repository, with a stub .pom file. Useful if you are using maven2 or the maven2 ant tasks in your project

one thing to consider here is having a proper pom file with the full dependencies in there.

Added:
    webservices/axis2/trunk/java/build.xml

Added: webservices/axis2/trunk/java/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/build.xml?rev=345482&view=auto
==============================================================================
--- webservices/axis2/trunk/java/build.xml (added)
+++ webservices/axis2/trunk/java/build.xml Fri Nov 18 04:39:20 2005
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<project name="axis2" default="default"
+
+    >
+
+  <!--
+  This is an ant build file to
+   -invoke maven to build the distribution
+   -copy the created files into the local Maven2 cache
+   -maybe deploy to a local cache, though that is NPE'ing right now.
+  -->
+
+
+  <!--
+  not putting this at the top level as it breaks idea's ant-awareness
+  xmlns:m2="antlib:org.apache.maven.artifact.ant"
+  -->
+
+  <!--any personal overrides; not read by maven-->
+  <property file="build.properties"/>
+
+  <!--any personal overrides; also read by maven-->
+  <property file="project.properties"/>
+  <!--read in project properties, including library versions-->
+  <property file="etc/project.properties"/>
+
+  <target name="default">
+
+  </target>
+
+  <target name="init" >
+    <!--macro for maven -->
+    <presetdef name="maven">
+      <exec failonerror="true" executable="maven">
+      </exec>
+    </presetdef>
+
+    <!-- location of m2 repository (with new layout) -->
+    <property name="m2.repository" location="${user.home}/.m2/repository"/>
+    <!-- original m1 repository -->
+    <property name="m1.repository" location="${user.home}/.maven/repository"/>
+
+    <property name="project.xml" location="etc/project.xml" />
+    <!-- pull out the value of the project version from the maven1 file-->
+    <xmlproperty file="${project.xml}"
+        keeproot="true" />
+
+    <property name="target.dir" location="target"/>
+    <property name="artifact.title" value="${project.id}-${project.currentVersion}" />
+    <property name="target.jar" location="${target.dir}/${artifact.title}.jar"/>
+    <property name="target.pom" location="${target.dir}/${artifact.title}.pom"/>
+
+  </target>
+
+
+
+  <target name="dist" depends="init">
+    <maven>
+    </maven>
+  </target>
+
+  <target name="dist-lite" depends="init">
+    <maven>
+      <arg value="-Dmaven.test.skip=true" />
+    </maven>
+  </target>
+
+
+  <!-- inline creation of a very minimal (zero dependency) pom -->
+  <target name="m2-pom" depends="init" xmlns:m2="antlib:org.apache.maven.artifact.ant">
+    <echo message="Creating Pom ${target.pom}" level="verbose"/>
+    <!--ant1.7's echoxml makes this easier -->
+<echo file="${target.pom}"><![CDATA[<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>${project.id}</groupId>
+  <artifactId>${project.id}</artifactId>
+  <packaging>jar</packaging>
+  <version>${project.currentVersion}</version>
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>${log4j.version}</version>
+    </dependency>
+  </dependencies>
+</project>
+]]></echo>
+    <m2:pom id="m2.pom" file="${target.pom}"/>
+  </target>
+
+
+  <target name="m2-wagons" depends="init"
+      xmlns:m2="antlib:org.apache.maven.artifact.ant">
+    <m2:install-provider artifactId="wagon-ssh"
+        version="${wagon-ssh.version}"/>
+    <m2:install-provider artifactId="wagon-ssh-external"
+        version="${wagon-ssh-external.version}"/>
+    <m2:install-provider artifactId="wagon-file"
+        version="${wagon-file.version}"/>
+    <m2:install-provider artifactId="wagon-ftp"
+        version="${wagon-ftp.version}"/>
+  </target>
+
+  <target name="ready-to-deploy" depends="m2-pom,dist-lite" />
+
+  <target name="m2-install" depends="ready-to-deploy"
+      xmlns:m2="antlib:org.apache.maven.artifact.ant">
+    <m2:install file="${target.jar}">
+      <pom refid="m2.pom"/>
+    </m2:install>
+  </target>
+
+  <target name="m2-filesys-deploy" depends="ready-to-deploy"
+      xmlns:m2="antlib:org.apache.maven.artifact.ant">
+    <fail unless="filesys.url">
+      filesys.url needs to be set to a file: url of the local destination
+      for in-filesystem deployment
+    </fail>
+    <m2:deploy file="${target.jar}">
+      <remoteRepository url="${filesys.url}"/>
+      <pom refid="m2.pom"/>
+    </m2:deploy>
+  </target>
+
+
+</project>
\ No newline at end of file