2009-01-11 20:47:58 -05:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
or more contributor license agreements. See the NOTICE file
|
|
|
|
distributed with this work for additional information
|
|
|
|
regarding copyright ownership. The ASF licenses this file
|
|
|
|
to you under the Apache License, Version 2.0 (the
|
|
|
|
"License"); you may not use this file except in compliance
|
|
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
|
|
software distributed under the License is distributed on an
|
|
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
KIND, either express or implied. See the License for the
|
|
|
|
specific language governing permissions and limitations
|
|
|
|
under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<!-- START SNIPPET: ant-bootstrap
|
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
By default the bootstrap will use ~/.m2/repository as the integration repository but you can define the integration
|
2009-01-11 20:47:58 -05:00
|
|
|
repository by specifying a property on the command line:
|
|
|
|
|
|
|
|
ant -Dmaven.repo.local=/my/integration/repository
|
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
Those familiar with Maven will note this is the same way the local repository can be set from the command-line.
|
2009-01-11 20:47:58 -05:00
|
|
|
This facilitates having a set of builds converge on the same repository for integration purposes.
|
|
|
|
|
|
|
|
END SNIPPET: ant-bootstrap -->
|
|
|
|
|
2009-01-29 21:23:13 -05:00
|
|
|
<project default="all" basedir="." xmlns:mercury="urn:mercury-ant-tasks">
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<property name="it.workdir.version" value="3.0.x"/>
|
|
|
|
|
|
|
|
<target name="initTaskDefs">
|
2009-02-18 14:52:54 -05:00
|
|
|
<xmlproperty file="pom.xml" prefix="pom" keepRoot="false"/>
|
2009-02-17 19:25:15 -05:00
|
|
|
<path id="mercury-ant-tasks.classpath" path="mercury-ant-tasks-1.0-alpha-6-SNAPSHOT.jar"/>
|
2009-01-11 20:56:57 -05:00
|
|
|
<typedef resource="org/apache/maven/mercury/ant/tasks/antlib.xml" uri="urn:mercury-ant-tasks" classpathref="mercury-ant-tasks.classpath"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="isMavenHomeSet" depends="initTaskDefs">
|
|
|
|
<property environment="env"/>
|
|
|
|
<condition property="maven.home" value="${env.M2_HOME}">
|
|
|
|
<isset property="env.M2_HOME"/>
|
|
|
|
</condition>
|
|
|
|
<fail message="You must set the M2_HOME environment variable or specify a maven.home property to this Ant script">
|
|
|
|
<condition>
|
|
|
|
<or>
|
|
|
|
<not>
|
|
|
|
<isset property="maven.home" />
|
|
|
|
</not>
|
|
|
|
<equals arg1="${maven.home}" arg2="" trim="true" />
|
|
|
|
</or>
|
|
|
|
</condition>
|
|
|
|
</fail>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="init" depends="isMavenHomeSet">
|
2009-03-20 19:01:03 -04:00
|
|
|
<xmlproperty prefix="pom" file="pom.xml"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
<basename file="${maven.home}" property="maven.home.basename"/>
|
|
|
|
<dirname file="${maven.home}" property="maven.home.dirname"/>
|
|
|
|
<!-- Initialize properties -->
|
|
|
|
<property name="maven.home.basename.expected" value="apache-maven-${pom.project.version}"/>
|
2009-02-23 16:49:48 -05:00
|
|
|
<property name="maven.assembly" location="apache-maven/target/${maven.home.basename.expected}-bin.zip"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
|
2009-03-04 19:30:16 -05:00
|
|
|
<property name="maven.repo.central" value="http://repository.sonatype.org/content/groups/public"/>
|
|
|
|
<!--
|
|
|
|
<property name="maven.repo.central" value="http://repo1.maven.org/maven2"/>
|
2009-03-06 19:57:13 -05:00
|
|
|
-->
|
|
|
|
<condition property="do.not.clean.local.repo">
|
|
|
|
<not>
|
|
|
|
<isset property="clean.local.repo"/>
|
|
|
|
</not>
|
|
|
|
</condition>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
|
|
|
<property name="surefire.useFile" value="true"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
<echo>maven.home = ${maven.home}</echo>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="clean-bootstrap" description="cleans up generated bootstrap classes">
|
|
|
|
<delete dir="bootstrap"/>
|
|
|
|
</target>
|
|
|
|
|
2009-03-06 19:57:13 -05:00
|
|
|
<target name="clean-local-repo" description="cleans up local repo" unless="do.not.clean.local.repo">
|
2009-03-06 19:59:54 -05:00
|
|
|
<delete dir="${maven.repo.local}"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
<mkdir dir="${maven.repo.local}"/>
|
2009-03-06 19:57:13 -05:00
|
|
|
</target>
|
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<target name="pull" depends="init,clean-local-repo" unless="skip.pull">
|
|
|
|
<property name="verbose" value="false"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
<!-- Pull the dependencies that Maven needs to build -->
|
|
|
|
<copy file="pom.xml" tofile="dependencies.xml"/>
|
|
|
|
<replace file="${basedir}/dependencies.xml" token="<!--start-->" value="<!--"/>
|
|
|
|
<replace file="${basedir}/dependencies.xml" token="<!--end-->" value="-->"/>
|
2009-02-17 19:25:15 -05:00
|
|
|
|
2009-02-18 14:52:54 -05:00
|
|
|
<mercury:local-repository location="${maven.repo.local}"/>
|
2009-02-21 02:46:00 -05:00
|
|
|
<mercury:remote-repository id="central" location="${maven.repo.central}"/>
|
2009-02-19 17:24:58 -05:00
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<property name="tsFormat" value="HH:mm:ss"/>
|
|
|
|
<tstamp><format property="start.time" pattern="${tsFormat}"/></tstamp>
|
2009-03-04 00:59:25 -05:00
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<!-- classpaths with default names: mercury.classpath, mercury.classpath.test, mercury.classpath.runtime -->
|
2009-02-21 02:46:00 -05:00
|
|
|
<mercury:resolve-dependencies scope="compile">
|
2009-02-19 17:24:58 -05:00
|
|
|
<mercury:dependency source="maven:${basedir}/dependencies.xml"/>
|
2009-02-18 14:52:54 -05:00
|
|
|
<mercury:dependency id="org.codehaus.plexus:plexus-component-metadata:${pom.properties.plexusVersion}"/>
|
2009-02-21 02:46:00 -05:00
|
|
|
|
|
|
|
<mercury:exclusions>
|
|
|
|
<mercury:exclusion id="org.sonatype.mercury:mercury-mp3-cli"/>
|
|
|
|
<mercury:exclusion id="org.sonatype.mercury:mercury-mp3-delta"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
<mercury:exclusion id="org.sonatype.mercury:mercury-mp3-api"/>
|
2009-02-21 02:46:00 -05:00
|
|
|
</mercury:exclusions>
|
|
|
|
|
2009-02-17 19:25:15 -05:00
|
|
|
</mercury:resolve-dependencies>
|
2009-02-21 02:46:00 -05:00
|
|
|
|
2009-03-04 00:59:25 -05:00
|
|
|
<tstamp><format property="stop.time" pattern="${tsFormat}"/></tstamp>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-03-04 20:55:20 -05:00
|
|
|
<echo>========================================================================</echo>
|
2009-03-04 19:30:16 -05:00
|
|
|
<echo>Mercury: start ${start.time}, stop ${stop.time}</echo>
|
2009-03-04 20:55:20 -05:00
|
|
|
<echo>========================================================================</echo>
|
|
|
|
<property name="mc" refid="mercury.classpath"/>
|
|
|
|
<echo>mercury.classpath=${mc}</echo>
|
|
|
|
<echo>========================================================================</echo>
|
2009-03-20 19:01:03 -04:00
|
|
|
<!--
|
2009-03-04 21:30:33 -05:00
|
|
|
-->
|
2009-03-04 00:59:25 -05:00
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<delete file="${basedir}/dependencies.xml"/>
|
2009-03-04 19:30:16 -05:00
|
|
|
|
|
|
|
<tstamp><format property="modello.start.time" pattern="${tsFormat}"/></tstamp>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-02-19 17:24:58 -05:00
|
|
|
<!-- only one named classpath: modello.classpath -->
|
|
|
|
<mercury:resolve-dependencies pathid="modello.classpath" scope="runtime">
|
2009-02-18 14:52:54 -05:00
|
|
|
<mercury:dependency id="org.codehaus.modello:modello-maven-plugin:${pom.properties.modelloVersion}"/>
|
|
|
|
</mercury:resolve-dependencies>
|
2009-02-19 17:24:58 -05:00
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<tstamp><format property="modello.stop.time" pattern="${tsFormat}"/></tstamp>
|
|
|
|
|
2009-03-04 19:30:16 -05:00
|
|
|
<echo>=======================================</echo>
|
|
|
|
<echo>Modello: start ${modello.start.time}, stop ${modello.stop.time}</echo>
|
|
|
|
<echo>=======================================</echo>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
<echo>========================================================================</echo>
|
|
|
|
<property name="modello.cp" refid="modello.classpath"/>
|
|
|
|
<echo>modello.cp=${modello.cp}</echo>
|
|
|
|
<echo>========================================================================</echo>
|
|
|
|
-->
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="process-classes" depends="pull" description="generates plexus component metadata.">
|
|
|
|
<mkdir dir="${basedir}/bootstrap/target"/>
|
|
|
|
<mkdir dir="${basedir}/bootstrap/target/classes"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<path id="maven.classpath">
|
|
|
|
<pathelement location="bootstrap/target/classes"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
<path refid="sources"/>
|
|
|
|
<path refid="mercury.classpath"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
</path>
|
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<echo>Using plexus version ${pom.properties.plexusVersion}</echo>
|
2009-01-11 20:47:58 -05:00
|
|
|
<java fork="fork" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
|
|
|
|
<classpath refid="maven.classpath"/>
|
|
|
|
<!-- We need to generate component descriptors from the maven-artifact sources which use javadoc annotations. -->
|
|
|
|
<arg value="--source"/>
|
|
|
|
<arg value="${basedir}/maven-compat/src/main/java"/>
|
|
|
|
<!-- We have separated the artifact handlers and lifecycle mappings into a separate file. -->
|
|
|
|
<arg value="--descriptors"/>
|
|
|
|
<arg value="${basedir}/maven-core/src/main/resources/META-INF/plexus"/>
|
|
|
|
<!-- Search the classes for annotations that we've compiled. -->
|
|
|
|
<arg value="--classes"/>
|
|
|
|
<arg value="${basedir}/bootstrap/target/classes"/>
|
|
|
|
<!-- We'll make one big fat components descriptor. -->
|
|
|
|
<arg value="--output"/>
|
|
|
|
<arg value="${basedir}/bootstrap/target/classes/META-INF/plexus/components.xml"/>
|
|
|
|
</java>
|
2009-03-20 19:01:03 -04:00
|
|
|
</target>
|
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<target name="generate-sources" depends="pull" description="generates Java sources from Modello mdo model files">
|
|
|
|
<mkdir dir="bootstrap/target"/>
|
|
|
|
<mkdir dir="bootstrap/target/generated-sources"/>
|
|
|
|
|
|
|
|
<macrodef name="modello-single-mode">
|
|
|
|
<attribute name="file"/>
|
|
|
|
<attribute name="mode"/>
|
|
|
|
<attribute name="version"/>
|
|
|
|
<sequential>
|
2009-02-19 17:24:58 -05:00
|
|
|
<java fork="fork" classname="org.codehaus.modello.ModelloCli" failonerror="true" classpathref="modello.classpath">
|
2009-02-19 14:02:40 -05:00
|
|
|
<arg file="@{file}"/> <!-- model file -->
|
|
|
|
<arg value="@{mode}"/> <!-- output type -->
|
|
|
|
<arg file="bootstrap/target/generated-sources"/> <!-- output directory -->
|
|
|
|
<arg value="@{version}"/> <!-- model version -->
|
|
|
|
<arg value="false"/> <!-- package with version -->
|
|
|
|
<arg value="true"/> <!-- use Java 5 -->
|
|
|
|
<arg value="UTF-8"/> <!-- encoding -->
|
2009-01-11 20:47:58 -05:00
|
|
|
</java>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
|
|
|
|
|
|
|
<macrodef name="modello">
|
|
|
|
<attribute name="file"/>
|
|
|
|
<attribute name="version" default="1.0.0"/>
|
|
|
|
<sequential>
|
|
|
|
<echo taskname="modello" message="Generating sources for @{file}"/>
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="java"/>
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-reader"/>
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-writer"/>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
|
|
|
|
|
|
|
<modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
|
|
|
|
<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
|
|
|
|
<modello file="maven-project/src/main/mdo/profiles.mdo"/>
|
|
|
|
<modello file="maven-core/src/main/mdo/settings.mdo"/>
|
|
|
|
<modello file="maven-toolchain/src/main/mdo/toolchains.xml"/>
|
|
|
|
<modello file="maven-compat/src/main/mdo/metadata.mdo"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="compile-boot" depends="generate-sources" description="compiles the bootstrap sources">
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<path id="sources">
|
|
|
|
<dirset dir=".">
|
|
|
|
<include name="bootstrap/target/generated-sources"/>
|
|
|
|
<include name="*/src/main/*"/>
|
|
|
|
</dirset>
|
|
|
|
</path>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<mkdir dir="bootstrap/target/classes"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<javac destdir="bootstrap/target/classes" encoding="UTF-8" source="1.5" target="1.5" debug="true">
|
|
|
|
<src refid="sources"/>
|
2009-02-19 17:24:58 -05:00
|
|
|
<classpath refid="mercury.classpath"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
</javac>
|
|
|
|
|
|
|
|
<path id="maven.classpath">
|
|
|
|
<pathelement location="bootstrap/target/classes"/>
|
|
|
|
<pathelement location="maven-compat/src/main/resources"/>
|
|
|
|
<path refid="sources"/>
|
2009-02-21 02:46:00 -05:00
|
|
|
<path refid="mercury.classpath"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
</path>
|
2009-02-21 02:46:00 -05:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
|
|
|
<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
|
|
|
|
<classpath refid="maven.classpath"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
<arg value="-e"/>
|
2009-01-11 20:47:58 -05:00
|
|
|
<arg value="-B"/>
|
|
|
|
<arg value="clean"/>
|
|
|
|
<arg value="install"/>
|
|
|
|
<arg value="-Dmaven.repo.local=${maven.repo.local}"/>
|
|
|
|
<arg value="-Dsurefire.useFile=${surefire.useFile}"/>
|
|
|
|
</java>
|
|
|
|
</target>
|
|
|
|
|
2009-03-20 19:01:03 -04:00
|
|
|
<target name="maven-assembly" depends="maven-compile" description="generates the Maven installation assembly using the bootstrap Maven">
|
2009-01-11 20:47:58 -05:00
|
|
|
<echo>
|
2009-03-20 19:01:03 -04:00
|
|
|
The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
|
2009-01-11 20:47:58 -05:00
|
|
|
This goal just validates the presence of that distribution.
|
|
|
|
</echo>
|
|
|
|
<condition property="build.failed">
|
|
|
|
<not>
|
|
|
|
<available file="${maven.assembly}"/>
|
|
|
|
</not>
|
|
|
|
</condition>
|
|
|
|
<fail if="build.failed" message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="extract-assembly" depends="init,maven-assembly" description="extracts the maven assembly into maven.home">
|
|
|
|
<echo>Extracting assembly to ${maven.home.dirname} ...</echo>
|
|
|
|
<!-- If we are starting from scratch make sure the directory is created -->
|
|
|
|
<delete dir="${maven.home}"/>
|
|
|
|
<mkdir dir="${maven.home}"/>
|
|
|
|
<unzip src="${maven.assembly}" dest="${maven.home.dirname}"/>
|
|
|
|
<chmod perm="+x">
|
|
|
|
<fileset dir="${maven.home}/bin">
|
|
|
|
<include name="mvn"/>
|
|
|
|
</fileset>
|
|
|
|
</chmod>
|
|
|
|
</target>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
<target name="all" depends="clean-bootstrap,init,extract-assembly"/>
|
2009-03-20 19:01:03 -04:00
|
|
|
|
2009-01-11 20:47:58 -05:00
|
|
|
</project>
|