| <project name="build" xmlns:mercury="antlib:org.apache.maven.mercury.ant.tasks"> |
| |
| <target name="initialize"> |
| <!-- |
| <path id="boot.classpath" path="target/mercury-all-1.0.jar" /> |
| <taskdef resource="org/apache/maven/mercury/ant/antlib.xml" uri="urn:mercury" classpathref="boot.classpath"/> |
| <taskdef resource="org/apache/maven/mercury/ant/antlib.xml" uri="urn:mercury"/> |
| --> |
| |
| </target> |
| |
| <!-- |
| | These are the things the user may want to control, for which we will provide defaults where possible: |
| | |
| | a) Remote artifact repositories for retrieval |
| | 1) Repository layout |
| | 2) Repository authentication |
| | 3) Checksum validation |
| | i) When on allow exclusions so that you don't get blocked by one bad checksum |
| | 4) PGP key validation |
| | i) When on allow exclusions so that you don't get blocked by one bad PGP key |
| | ii) Location of keyring |
| | b) Local artifact repository for storage |
| | 1) Repository layout |
| | c) Classpath for runtime scoped artifacts |
| | d) Classpath for runtime scoped artifacts |
| | e) Classpath for test scoped artifacts (yes, i know this is mavenesque) |
| | f) Classpath for compile scoped artifacts (yes, i know this is mavenesqe) |
| | g) Fileset for runtime scoped artifacts |
| | h) Fileset for runtime scoped artifacts |
| | i) Fileset for test scoped artifacts (yes, i know this is mavenesque) |
| | j) Fileset for compile scoped artifacts (yes, i know this is mavenesqe) |
| | k) transitivity |
| | |
| | authentication |
| | keystore |
| --> |
| |
| <target name="download"> |
| |
| <!-- |
| | a) Maven Central |
| | 1) Maven 2.x layout |
| | 2) none |
| | 3) warn |
| | 4) none |
| | b) ~/.m2/repository |
| | c) mercury.classpath |
| | d) mercury.classpath.runtime |
| | e) mercury.classpath.test |
| | f) mercury.classpath.compile |
| | g) mercury.fileset |
| | h) mercury.fileset.runtime |
| | i) mercury.fileset.test |
| | j) mercury.fileset.compile |
| | |
| --> |
| |
| <!-- (1) --> |
| <!-- |
| | |
| | This is the most basic use of the tasks where you specify dependencies with their GAV and all the defaults |
| | are setup for you. |
| | |
| --> |
| |
| <!-- redefine local and central for testing --> |
| <mercury:local-repository location="${localRepo}"/> |
| <mercury:remote-repository location="${remoteRepo}"/> |
| |
| <mercury:resolve-dependencies> |
| <mercury:dependency id="g0:a0:v0"/> |
| <mercury:dependency id="g1:a1:v1"/> |
| <mercury:dependency id="g2:a2:v2"/> |
| </mercury:resolve-dependencies> |
| |
| </target> |
| |
| <target name="download-pom" depends="initialize"> |
| |
| <!-- redefine local and central for testing --> |
| <mercury:local-repository location="${localRepo}"/> |
| <mercury:remote-repository location="${remoteRepo}"/> |
| |
| <!-- (2) --> |
| <!-- |
| | |
| | This is the most basic use of the tasks where you specify dependencies with a POM and all the defaults |
| | are setup for you. |
| | |
| | NOTE: You will notice that the source is of the form <processor>:<resource>. So in this case we're going |
| | to use the Maven dependency processor and a local pom.xml file. |
| | |
| --> |
| <mercury:resolve-dependencies source="maven:${basedir}/target/test-classes/pom.xml"/> |
| |
| </target> |
| |
| |
| <target name="download-pom-non-transtive"> |
| |
| <!-- redefine local and central for testing --> |
| <mercury:local-repository location="${localRepo}"/> |
| <mercury:remote-repository location="${remoteRepo}"/> |
| |
| <mercury:resolve-dependencies |
| transitive="false" |
| source="maven:${basedir}/target/test-classes/pom-non-transitive.xml" |
| /> |
| |
| <property name="cp" refid="mercury.classpath"/> |
| |
| <property name="cp.dir" location="${basedir}/target/test-copy"/> |
| <delete dir="${cp.dir}"/> |
| <mkdir dir="${cp.dir}"/> |
| <copy todir="${cp.dir}" flatten="true"> |
| <fileset refid="mercury.classpath.fileset"/> |
| </copy> |
| |
| <property name="cpr.dir" location="${basedir}/target/test-copy-runtime"/> |
| <delete dir="${cpr.dir}"/> |
| <mkdir dir="${cpr.dir}"/> |
| <copy todir="${cpr.dir}" flatten="true"> |
| <fileset refid="mercury.classpath.fileset"/> |
| </copy> |
| |
| </target> |
| |
| <target name="repo-pgp"> |
| |
| <mercury:local-repository location="${localRepo}"/> |
| <!-- Control checksum and pgp globally for all remote repositories used --> |
| <mercury:remote-repositories sha1Validation="true" pgpValidation="true"> |
| <mercury:repository location="${remoteRepo}/good"/> |
| <mercury:repository location="${remoteRepo}/bad" |
| sha1Validation="false" |
| pgpValidation="false" |
| /> |
| </mercury:remote-repositories> |
| |
| <mercury:resolve-dependencies source="maven:${basedir}/target/test-classes/pom-non-transitive.xml"/> |
| |
| </target> |
| |
| <target name="exclusions"> |
| |
| <mercury:local-repository location="${localRepo}"/> |
| <mercury:repository location="${remoteRepo}"/> |
| |
| <mercury:resolve-dependencies source="maven:${basedir}/target/test-classes/pom.xml"> |
| <mercury:exclusions> |
| <mercury:exclusion id="g2:a2"/> |
| </mercury:exclusions> |
| </mercury:resolve-dependencies> |
| |
| <property name="cp" refid="mercury.classpath"/> |
| |
| </target> |
| |
| |
| |
| |
| <target name="download-repos-pgp-2"> |
| |
| <mercury:resolve-dependencies source="maven:pom.xml"> |
| <mercury:local-repository location="${basedir}/lib" layout="flat"/> |
| <mercury:remote-repositories checksum-validation="true"> |
| <!-- The presence of this element says we want this feature turned on, and allow some configuration --> |
| <mercury:pgp-key-validation keyring-location="${basedir}/pgp/project-keyring.gpg"/> |
| <mercury:remote-repository location="http://repository.sonatype.com/groups/public"> |
| <!-- Here we can have pluggable providers and we can probably just leverage JSecurity --> |
| <mercury:authentication source="basic:username:password"/> |
| </mercury:remote-repository> |
| <mercury:remote-repository location="http://repository.sonatype.com/groups/bad" checksum-validation="false" pgp-validation="false"/> |
| </mercury:remote-repositories> |
| </mercury:resolve-dependencies> |
| |
| </target> |
| |
| <target name="download-repos-3"> |
| |
| <mercury:resolve-dependencies source="maven:pom.xml"> |
| <mercury:local-repository location="${basedir}/lib" layout="flat"/> |
| <mercury:remote-repositories checksum-validation="true"> |
| <!-- The presence of this element says we want this feature turned on, and allow some configuration --> |
| <mercury:pgp-key-validation keyring-location="${basedir}/pgp/project-keyring.gpg"> |
| <exclude id="g0:a0:v0"/> |
| </mercury:pgp-key-validation> |
| <mercury:remote-repository location="http://repository.sonatype.com/groups/public"/> |
| <mercury:remote-repository location="http://repository.sonatype.com/groups/bad" checksum-validation="false" pgp-validation="false"/> |
| </mercury:remote-repositories> |
| </mercury:resolve-dependencies> |
| |
| </target> |
| |
| </project> |