2005-06-21 19:25:26 -04:00
|
|
|
<project name="foo" default="foo" xmlns:artifact="urn:maven-artifact-ant">
|
2005-09-16 09:42:55 -04:00
|
|
|
<!--
|
|
|
|
<project name="foo" default="foo" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
|
|
|
|
-->
|
2005-07-21 20:59:52 -04:00
|
|
|
<!--
|
2005-06-21 19:25:26 -04:00
|
|
|
You either need to run the the 'initTaskDefs' task below and
|
|
|
|
define the artifact namespace like above (choose anything you
|
|
|
|
like except strings that start with 'antlib:'),
|
|
|
|
and be sure to supply the path to the maven-artifact-ant jars
|
|
|
|
|
|
|
|
OR
|
|
|
|
|
|
|
|
just define the artifact namespace as follows:
|
|
|
|
|
|
|
|
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
|
|
|
|
|
|
|
|
and be sure to add the maven-artifact-ant jars to the ant
|
|
|
|
classpath (either by setting the CLASSPATH environment variable
|
|
|
|
before calling ant, or place the jars in the $ANT_HOME/lib directory).
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
<target name="initTaskDefs">
|
2005-09-16 09:42:55 -04:00
|
|
|
<!-- don't forget to update the version! -->
|
2005-06-21 19:25:26 -04:00
|
|
|
<path id="maven.classpath">
|
2005-10-08 10:13:31 -04:00
|
|
|
<pathelement location="target/maven-artifact-ant-2.0-beta-4-SNAPSHOT-dep.jar"/>
|
2005-06-21 19:25:26 -04:00
|
|
|
</path>
|
|
|
|
|
2005-06-22 14:08:21 -04:00
|
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
2005-06-21 19:25:26 -04:00
|
|
|
<classpath refid="maven.classpath"/>
|
|
|
|
</typedef>
|
2005-10-10 04:16:18 -04:00
|
|
|
|
|
|
|
<artifact:localRepository id="local.repository" location="${basedir}/target/local-repo" layout="default"/>
|
|
|
|
|
|
|
|
<artifact:remoteRepository id="deploy.repository" url="file://localhost/${basedir}/target/deployment-repo" layout="legacy"/>
|
|
|
|
|
|
|
|
<artifact:pom file="pom.xml" id="maven.project"/>
|
|
|
|
|
2005-06-21 19:25:26 -04:00
|
|
|
</target>
|
|
|
|
|
2005-09-03 02:18:23 -04:00
|
|
|
<target name="test-no-deps" depends="initTaskDefs">
|
2005-09-12 03:17:11 -04:00
|
|
|
<artifact:dependencies filesetId="runtime.fileset">
|
|
|
|
</artifact:dependencies>
|
|
|
|
<copy todir="target/test-no-deps" verbose="true">
|
|
|
|
<fileset refid="runtime.fileset"/>
|
|
|
|
</copy>
|
2005-09-03 02:18:23 -04:00
|
|
|
</target>
|
|
|
|
|
2005-07-22 02:28:20 -04:00
|
|
|
<target name="test-bad-dep" depends="initTaskDefs">
|
|
|
|
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
|
|
|
<dependency groupId="foo" artifactId="foo" version="1.0-alpha-2"/>
|
|
|
|
</artifact:dependencies>
|
|
|
|
</target>
|
|
|
|
|
2005-06-21 19:25:26 -04:00
|
|
|
<target name="test-pom" depends="initTaskDefs">
|
2005-06-07 23:08:20 -04:00
|
|
|
<artifact:pom file="pom.xml" id="my.maven.project"/>
|
|
|
|
|
2005-06-21 19:25:26 -04:00
|
|
|
<echo>Artifact ID = ${my.maven.project.artifactId}</echo>
|
2005-04-18 00:12:34 -04:00
|
|
|
|
2005-06-21 19:25:26 -04:00
|
|
|
<echo>Parent Artifact ID = ${my.maven.project.parent.artifactId}</echo>
|
2005-06-07 23:08:20 -04:00
|
|
|
</target>
|
|
|
|
|
2005-09-15 21:48:53 -04:00
|
|
|
<target name="test-legacy-pom" depends="initTaskDefs">
|
|
|
|
<artifact:dependencies>
|
|
|
|
<dependency groupId="geronimo-spec" artifactId="geronimo-spec-javamail" version="1.3.1-rc5" />
|
|
|
|
<localRepository location="${basedir}/target/local-repo-legacy" />
|
|
|
|
<remoteRepository url="http://repo1.maven.org/maven" layout="legacy" id="central" />
|
|
|
|
</artifact:dependencies>
|
|
|
|
</target>
|
|
|
|
|
2005-06-21 19:25:26 -04:00
|
|
|
<target name="foo" depends="initTaskDefs">
|
2005-05-16 21:04:43 -04:00
|
|
|
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
2005-10-11 00:58:13 -04:00
|
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-4">
|
2005-06-22 14:08:21 -04:00
|
|
|
<exclusion groupId="junit" artifactId="junit"/>
|
2005-06-07 11:51:25 -04:00
|
|
|
</dependency>
|
2005-09-12 03:17:11 -04:00
|
|
|
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-6-SNAPSHOT"/>
|
2005-07-21 20:59:52 -04:00
|
|
|
<dependency groupId="org.apache.maven" artifactId="maven-core-it-support-old-location" version="1.1"/>
|
2005-04-18 03:09:16 -04:00
|
|
|
<localRepository refid="local.repository"/>
|
2005-08-24 09:34:50 -04:00
|
|
|
<remoteRepository url="http://snapshots.maven.codehaus.org/maven2">
|
|
|
|
<snapshots enabled="true"/>
|
|
|
|
<releases enabled="false"/>
|
|
|
|
</remoteRepository>
|
2005-04-18 00:12:34 -04:00
|
|
|
</artifact:dependencies>
|
|
|
|
|
2005-05-16 21:04:43 -04:00
|
|
|
<copy todir="target/files">
|
2005-06-22 14:08:21 -04:00
|
|
|
<fileset refid="dependency.fileset"/>
|
2005-05-16 21:04:43 -04:00
|
|
|
</copy>
|
|
|
|
|
2005-06-22 14:29:24 -04:00
|
|
|
<artifact:dependencies filesetId="my.dependency.fileset" verbose="true">
|
2005-06-22 14:08:21 -04:00
|
|
|
<pom refid="maven.project"/>
|
2005-06-07 20:18:53 -04:00
|
|
|
</artifact:dependencies>
|
|
|
|
|
|
|
|
<copy todir="target/my-dependencies">
|
2005-06-22 14:08:21 -04:00
|
|
|
<fileset refid="my.dependency.fileset"/>
|
2005-08-24 11:06:54 -04:00
|
|
|
</copy>
|
|
|
|
|
|
|
|
<artifact:dependencies filesetId="my.compile.dependency.fileset" useScope="compile">
|
|
|
|
<pom refid="maven.project"/>
|
|
|
|
</artifact:dependencies>
|
|
|
|
|
|
|
|
<copy todir="target/my-compile-dependencies">
|
|
|
|
<fileset refid="my.compile.dependency.fileset"/>
|
2005-06-07 20:18:53 -04:00
|
|
|
</copy>
|
|
|
|
|
2005-10-10 04:16:18 -04:00
|
|
|
<antcall target="test-deploy" />
|
|
|
|
|
|
|
|
<antcall target="test-legacy-pom" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="test-deploy-spaces" depends="initTaskDefs">
|
|
|
|
<artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-5-SNAPSHOT"/>
|
|
|
|
|
2005-10-10 04:27:52 -04:00
|
|
|
<echo file="target/test file.txt">dummy</echo>
|
|
|
|
<artifact:deploy file="target/test file.txt">
|
2005-10-10 04:16:18 -04:00
|
|
|
<remoteRepository url="scp://localhost/tmp/deployment-repo" />
|
|
|
|
<pom refid="maven.project"/>
|
|
|
|
</artifact:deploy>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="test-deploy" depends="initTaskDefs">
|
2005-07-21 20:59:52 -04:00
|
|
|
<property name="outJar" value="${maven.project.build.directory}/${maven.project.build.finalName}.jar"/>
|
|
|
|
|
|
|
|
<artifact:install file="${outJar}">
|
2005-04-18 03:09:16 -04:00
|
|
|
<pom refid="maven.project"/>
|
2005-04-18 00:12:34 -04:00
|
|
|
</artifact:install>
|
|
|
|
|
2005-09-16 09:42:55 -04:00
|
|
|
<echo>Note: only works on snapshots!</echo>
|
2005-07-21 20:59:52 -04:00
|
|
|
<artifact:deploy file="${outJar}">
|
2005-08-24 09:34:50 -04:00
|
|
|
<remoteSnapshotRepository refid="deploy.repository"/>
|
2005-04-18 03:09:16 -04:00
|
|
|
<pom refid="maven.project"/>
|
|
|
|
</artifact:deploy>
|
|
|
|
|
2005-10-10 04:16:18 -04:00
|
|
|
<artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-5-SNAPSHOT"/>
|
2005-08-24 09:34:50 -04:00
|
|
|
|
2005-07-21 20:59:52 -04:00
|
|
|
<artifact:deploy file="${outJar}">
|
2005-04-18 03:09:16 -04:00
|
|
|
<remoteRepository url="scp://localhost/tmp/deployment-repo">
|
|
|
|
<authentication username="brett" privateKey="${user.home}/.ssh/id_dsa"/>
|
|
|
|
</remoteRepository>
|
|
|
|
<pom refid="maven.project"/>
|
2005-04-18 00:12:34 -04:00
|
|
|
</artifact:deploy>
|
|
|
|
</target>
|
2005-04-29 02:49:53 -04:00
|
|
|
|
2005-06-21 19:25:26 -04:00
|
|
|
<target name="test-scm" depends="initTaskDefs">
|
2005-10-10 04:16:18 -04:00
|
|
|
<echo>Testing SCM Wagon</echo>
|
2005-06-22 14:08:21 -04:00
|
|
|
<mkdir dir="target"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
|
|
|
|
<pathconvert targetos="unix" property="repo.path.unix">
|
|
|
|
<map from="c:" to=""/>
|
|
|
|
<path>
|
2005-06-22 14:08:21 -04:00
|
|
|
<pathelement location="${basedir}/target/deployment-repo-scm"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
</path>
|
|
|
|
</pathconvert>
|
|
|
|
|
2005-06-22 14:08:21 -04:00
|
|
|
<property name="scm.url" value="file://${repo.path.unix}"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
|
2005-06-22 14:08:21 -04:00
|
|
|
<delete dir="${repo.path.unix}"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
|
|
|
|
<exec executable="svnadmin" failonerror="true">
|
2005-06-22 14:08:21 -04:00
|
|
|
<arg line="create ${repo.path.unix}"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
</exec>
|
|
|
|
|
|
|
|
<artifact:localRepository id="local.repository" location="${basedir}/target/local-repo" layout="default"/>
|
|
|
|
|
|
|
|
<artifact:remoteRepository id="deploy.repository" url="scm:svn:${scm.url}" layout="default"/>
|
|
|
|
|
|
|
|
<artifact:dependencies pathId="dependency.classpath">
|
2005-10-11 00:58:13 -04:00
|
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-4"/>
|
2005-09-12 03:17:11 -04:00
|
|
|
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-6-SNAPSHOT"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
<localRepository refid="local.repository"/>
|
|
|
|
</artifact:dependencies>
|
|
|
|
|
|
|
|
<exec executable="svn" dir="${basedir}/target/local-repo" failonerror="true">
|
2005-06-22 14:08:21 -04:00
|
|
|
<arg line="import -m 'import' ${scm.url}"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
</exec>
|
|
|
|
|
2005-06-22 14:08:21 -04:00
|
|
|
<delete dir="${basedir}/target/local-repo-scm"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
|
2005-04-29 05:31:42 -04:00
|
|
|
<!-- Could the SCM provider initialise this? -->
|
|
|
|
<exec executable="svn" dir="${basedir}/target" failonerror="true">
|
2005-06-22 14:08:21 -04:00
|
|
|
<arg line="co ${scm.url} -N local-repo-scm"/>
|
2005-04-29 05:31:42 -04:00
|
|
|
</exec>
|
|
|
|
|
2005-04-29 02:49:53 -04:00
|
|
|
<artifact:localRepository id="local.repository.scm" location="${basedir}/target/local-repo-scm" layout="default"/>
|
|
|
|
|
2005-04-29 05:31:42 -04:00
|
|
|
<artifact:dependencies pathId="dependency.classpath.scm">
|
2005-10-11 00:58:13 -04:00
|
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-4"/>
|
2005-09-12 03:17:11 -04:00
|
|
|
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-6-SNAPSHOT"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
<localRepository refid="local.repository.scm"/>
|
|
|
|
<remoteRepository refid="deploy.repository"/>
|
|
|
|
</artifact:dependencies>
|
|
|
|
|
2005-07-21 20:59:52 -04:00
|
|
|
<property name="outJar" value="${maven.project.build.directory}/${maven.project.build.finalName}.jar"/>
|
|
|
|
<artifact:deploy file="${outJar}">
|
2005-04-29 02:49:53 -04:00
|
|
|
<localRepository refid="local.repository.scm"/>
|
2005-06-22 14:08:21 -04:00
|
|
|
<remoteRepository refid="deploy.repository"/>
|
2005-04-29 02:49:53 -04:00
|
|
|
<pom refid="maven.project"/>
|
|
|
|
</artifact:deploy>
|
|
|
|
</target>
|
2005-10-11 00:38:44 -04:00
|
|
|
|
|
|
|
<target name="test-invalid-pom-ref" depends="initTaskDefs">
|
|
|
|
<artifact:dependencies>
|
|
|
|
<pom refid="invalid-ref" />
|
|
|
|
</artifact:dependencies>
|
|
|
|
</target>
|
2005-10-11 00:58:13 -04:00
|
|
|
|
|
|
|
<target name="test-no-dist-mgmt" depends="initTaskDefs">
|
|
|
|
<artifact:deploy file="sample-build-test.pom">
|
|
|
|
<pom file="sample-build-test.pom" />
|
|
|
|
<remoteRepository refid="deploy.repository" />
|
|
|
|
</artifact:deploy>
|
|
|
|
</target>
|
2005-04-18 00:12:34 -04:00
|
|
|
</project>
|
|
|
|
|