mirror of https://github.com/apache/maven.git
219 lines
8.0 KiB
XML
219 lines
8.0 KiB
XML
<project name="foo" default="foo" xmlns:artifact="urn:maven-artifact-ant">
|
|
<!--
|
|
<project name="foo" default="foo" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
|
|
-->
|
|
<!--
|
|
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">
|
|
<!-- don't forget to update the version! -->
|
|
<path id="maven.classpath">
|
|
<pathelement location="target/maven-artifact-ant-2.0.1-SNAPSHOT-dep.jar" />
|
|
</path>
|
|
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
|
<classpath refid="maven.classpath"/>
|
|
</typedef>
|
|
|
|
<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"/>
|
|
|
|
</target>
|
|
|
|
<target name="test-no-deps" depends="initTaskDefs">
|
|
<artifact:dependencies filesetId="runtime.fileset">
|
|
</artifact:dependencies>
|
|
<copy todir="target/test-no-deps" verbose="true">
|
|
<fileset refid="runtime.fileset"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<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>
|
|
|
|
<target name="test-pom" depends="initTaskDefs">
|
|
<artifact:pom file="pom.xml" id="my.maven.project"/>
|
|
|
|
<echo>Artifact ID = ${my.maven.project.artifactId}</echo>
|
|
|
|
<echo>Parent Artifact ID = ${my.maven.project.parent.artifactId}</echo>
|
|
</target>
|
|
|
|
<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>
|
|
|
|
<target name="foo" depends="initTaskDefs">
|
|
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-4">
|
|
<exclusion groupId="junit" artifactId="junit"/>
|
|
</dependency>
|
|
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-6-SNAPSHOT"/>
|
|
<dependency groupId="org.apache.maven" artifactId="maven-core-it-support-old-location" version="1.1"/>
|
|
<localRepository refid="local.repository"/>
|
|
<remoteRepository url="http://snapshots.maven.codehaus.org/maven2">
|
|
<snapshots enabled="true"/>
|
|
<releases enabled="false"/>
|
|
</remoteRepository>
|
|
</artifact:dependencies>
|
|
|
|
<copy todir="target/files">
|
|
<fileset refid="dependency.fileset"/>
|
|
</copy>
|
|
|
|
<artifact:dependencies filesetId="my.dependency.fileset" verbose="true">
|
|
<pom refid="maven.project"/>
|
|
</artifact:dependencies>
|
|
|
|
<copy todir="target/my-dependencies">
|
|
<fileset refid="my.dependency.fileset"/>
|
|
</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"/>
|
|
</copy>
|
|
|
|
<copy todir="target/my-compile-dependencies/WEB-INF/lib">
|
|
<fileset refid="my.compile.dependency.fileset"/>
|
|
<mapper type="flatten" />
|
|
</copy>
|
|
|
|
<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"/>
|
|
|
|
<echo file="target/test file.txt">dummy</echo>
|
|
<artifact:deploy file="target/test file.txt">
|
|
<remoteRepository url="scp://localhost/tmp/deployment-repo" />
|
|
<pom refid="maven.project"/>
|
|
</artifact:deploy>
|
|
</target>
|
|
|
|
<target name="test-deploy" depends="initTaskDefs">
|
|
<property name="outJar" value="${maven.project.build.directory}/${maven.project.build.finalName}.jar"/>
|
|
|
|
<artifact:install file="${outJar}">
|
|
<pom refid="maven.project"/>
|
|
</artifact:install>
|
|
|
|
<echo>Note: only works on snapshots!</echo>
|
|
<artifact:deploy file="${outJar}">
|
|
<remoteSnapshotRepository refid="deploy.repository"/>
|
|
<pom refid="maven.project"/>
|
|
</artifact:deploy>
|
|
|
|
<artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-5"/>
|
|
|
|
<artifact:deploy file="${outJar}">
|
|
<remoteRepository url="scp://localhost/tmp/deployment-repo">
|
|
<authentication username="brett" privateKey="${user.home}/.ssh/id_dsa"/>
|
|
</remoteRepository>
|
|
<pom refid="maven.project"/>
|
|
</artifact:deploy>
|
|
</target>
|
|
|
|
<target name="test-scm" depends="initTaskDefs">
|
|
<echo>Testing SCM Wagon</echo>
|
|
<mkdir dir="target"/>
|
|
|
|
<pathconvert targetos="unix" property="repo.path.unix">
|
|
<map from="c:" to=""/>
|
|
<path>
|
|
<pathelement location="${basedir}/target/deployment-repo-scm"/>
|
|
</path>
|
|
</pathconvert>
|
|
|
|
<property name="scm.url" value="file://${repo.path.unix}"/>
|
|
|
|
<delete dir="${repo.path.unix}"/>
|
|
|
|
<exec executable="svnadmin" failonerror="true">
|
|
<arg line="create ${repo.path.unix}"/>
|
|
</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">
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-4"/>
|
|
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-6-SNAPSHOT"/>
|
|
<localRepository refid="local.repository"/>
|
|
</artifact:dependencies>
|
|
|
|
<exec executable="svn" dir="${basedir}/target/local-repo" failonerror="true">
|
|
<arg line="import -m 'import' ${scm.url}"/>
|
|
</exec>
|
|
|
|
<delete dir="${basedir}/target/local-repo-scm"/>
|
|
|
|
<!-- Could the SCM provider initialise this? -->
|
|
<exec executable="svn" dir="${basedir}/target" failonerror="true">
|
|
<arg line="co ${scm.url} -N local-repo-scm"/>
|
|
</exec>
|
|
|
|
<artifact:localRepository id="local.repository.scm" location="${basedir}/target/local-repo-scm" layout="default"/>
|
|
|
|
<artifact:dependencies pathId="dependency.classpath.scm">
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-4"/>
|
|
<dependency groupId="plexus" artifactId="plexus-container-default" version="1.0-alpha-6-SNAPSHOT"/>
|
|
<localRepository refid="local.repository.scm"/>
|
|
<remoteRepository refid="deploy.repository"/>
|
|
</artifact:dependencies>
|
|
|
|
<property name="outJar" value="${maven.project.build.directory}/${maven.project.build.finalName}.jar"/>
|
|
<artifact:deploy file="${outJar}">
|
|
<localRepository refid="local.repository.scm"/>
|
|
<remoteRepository refid="deploy.repository"/>
|
|
<pom refid="maven.project"/>
|
|
</artifact:deploy>
|
|
</target>
|
|
|
|
<target name="test-invalid-pom-ref" depends="initTaskDefs">
|
|
<artifact:dependencies>
|
|
<pom refid="invalid-ref" />
|
|
</artifact:dependencies>
|
|
</target>
|
|
|
|
<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>
|
|
</project>
|
|
|