mirror of https://github.com/apache/maven.git
171 lines
6.4 KiB
XML
171 lines
6.4 KiB
XML
<project name="foo" default="foo" xmlns:artifact="urn: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">
|
|
<path id="maven.classpath">
|
|
<!-- don't forget to set the value! -->
|
|
<pathelement location="target/maven-artifact-ant-2.0-beta-1-SNAPSHOT-dep.jar"/>
|
|
</path>
|
|
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
|
|
<classpath refid="maven.classpath"/>
|
|
</typedef>
|
|
</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="foo" depends="initTaskDefs">
|
|
<artifact:localRepository id="local.repository" location="${basedir}/target/local-repo" layout="default"/>
|
|
|
|
<artifact:remoteRepository id="deploy.repository" url="file://${basedir}/target/deployment-repo" layout="legacy"/>
|
|
|
|
<artifact:pom file="pom.xml" id="maven.project"/>
|
|
|
|
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2">
|
|
<exclusion groupId="junit" artifactId="junit"/>
|
|
</dependency>
|
|
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-4-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>
|
|
|
|
<property name="outJar" value="${maven.project.build.directory}/${maven.project.build.finalName}.jar"/>
|
|
|
|
<artifact:install file="${outJar}">
|
|
<pom refid="maven.project"/>
|
|
</artifact:install>
|
|
|
|
<artifact:deploy file="${outJar}">
|
|
<remoteSnapshotRepository refid="deploy.repository"/>
|
|
<pom refid="maven.project"/>
|
|
</artifact:deploy>
|
|
|
|
<artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-4"/>
|
|
|
|
<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">
|
|
<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-2"/>
|
|
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-4-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-2"/>
|
|
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-4-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>
|
|
</project>
|
|
|