2007-02-28 17:57:03 -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
|
|
|
|
|
2009-05-25 01:26:27 -04:00
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-28 17:57:03 -05:00
|
|
|
|
|
|
|
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.
|
|
|
|
-->
|
|
|
|
|
2008-12-16 23:08:44 -05:00
|
|
|
<!-- START SNIPPET: ant-bootstrap
|
2008-07-10 08:10:04 -04:00
|
|
|
|
2009-02-17 16:46:38 -05:00
|
|
|
By default the bootstrap will use ~/.m2/repository as the integration repository but you can define the integration
|
2008-12-16 23:08:44 -05:00
|
|
|
repository by specifying a property on the command line:
|
2008-07-10 08:10:04 -04:00
|
|
|
|
|
|
|
ant -Dmaven.repo.local=/my/integration/repository
|
|
|
|
|
2009-02-17 16:46:38 -05:00
|
|
|
Those familiar with Maven will note this is the same way the local repository can be set from the command-line.
|
2008-12-16 23:08:44 -05:00
|
|
|
This facilitates having a set of builds converge on the same repository for integration purposes.
|
2008-07-13 14:11:17 -04:00
|
|
|
|
2008-12-16 23:08:44 -05:00
|
|
|
END SNIPPET: ant-bootstrap -->
|
2008-07-10 08:10:04 -04:00
|
|
|
|
2008-04-15 11:41:13 -04:00
|
|
|
<project default="all" basedir="." xmlns:artifact="urn:maven-artifact-ant">
|
2009-02-17 16:46:38 -05:00
|
|
|
|
2011-07-28 12:46:23 -04:00
|
|
|
<property name="distributionDirectory" value="apache-maven"/>
|
2011-07-28 13:11:26 -04:00
|
|
|
<property name="distributionId" value="apache-maven"/>
|
|
|
|
<property name="distributionShortName" value="Maven"/>
|
|
|
|
<property name="distributionName" value="Apache Maven"/>
|
2009-05-25 02:40:34 -04:00
|
|
|
<property name="it.workdir.version" value="3.0.x" />
|
2012-12-14 09:00:10 -05:00
|
|
|
<property name="maven-compile.jvmargs" value="-Xmx512m -Xms512m"/>
|
|
|
|
<property name="maven-compile.fork" value="true"/>
|
2012-12-14 09:29:00 -05:00
|
|
|
<property name="maven-compile.maxmemory" value="512m"/>
|
2009-05-25 02:40:34 -04:00
|
|
|
|
|
|
|
<target name="initTaskDefs">
|
2011-07-28 12:46:23 -04:00
|
|
|
<echo>Building ${distributionName} ...</echo>
|
2010-09-26 13:31:37 -04:00
|
|
|
<xmlproperty file="pom.xml" prefix="xmlPom" />
|
2010-07-20 06:00:22 -04:00
|
|
|
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.1.jar" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
|
|
|
|
</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>
|
2010-05-08 14:43:13 -04:00
|
|
|
<available property="maven.home.exists" file="${maven.home}" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="prompt-maven-home-exists" depends="isMavenHomeSet" if="maven.home.exists">
|
|
|
|
<input addproperty="maven.home.exists.continue" validargs="yes,no" defaultvalue="no">WARNING:
|
|
|
|
The specified target directory
|
|
|
|
${maven.home}
|
|
|
|
already exists. It will be deleted and overwritten by the build.
|
|
|
|
Do you want to continue?</input>
|
|
|
|
<fail message="Build was aborted by user">
|
|
|
|
<condition>
|
|
|
|
<equals arg1="${maven.home.exists.continue}" arg2="no" trim="true" casesensitive="false" />
|
|
|
|
</condition>
|
|
|
|
</fail>
|
2009-05-25 02:40:34 -04:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="init" depends="isMavenHomeSet">
|
|
|
|
<!-- Initialize properties -->
|
2011-07-28 13:11:26 -04:00
|
|
|
<property name="maven.home.basename.expected" value="${distributionId}-${xmlPom.project.version}" />
|
2011-07-28 12:46:23 -04:00
|
|
|
<property name="maven.assembly" location="${distributionDirectory}/target/${maven.home.basename.expected}-bin.zip" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<property name="maven.repo.local" value="${user.home}/.m2/repository" />
|
|
|
|
<property name="maven.debug" value="-e" />
|
|
|
|
<property name="maven.test.skip" value="false" />
|
2010-08-26 05:46:46 -04:00
|
|
|
<property name="skipTests" value="false" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<property name="surefire.useFile" value="true" />
|
2009-06-20 15:54:26 -04:00
|
|
|
<property name="maven.test.redirectTestOutputToFile" value="${surefire.useFile}" />
|
2010-11-23 10:36:02 -05:00
|
|
|
<property name="maven.goal" value="install" />
|
2010-05-08 14:04:28 -04:00
|
|
|
<echo>maven.home = ${maven.home}</echo>
|
2009-05-25 02:40:34 -04:00
|
|
|
<echo>maven.repo.local = ${maven.repo.local}</echo>
|
2011-07-28 12:46:23 -04:00
|
|
|
<echo>distributionId = ${distributionId}</echo>
|
|
|
|
<echo>distributionName = ${distributionName}</echo>
|
|
|
|
<echo>distributionDirectory = ${distributionDirectory}</echo>
|
2009-05-25 02:40:34 -04:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="clean-bootstrap" description="cleans up generated bootstrap classes">
|
|
|
|
<delete dir="bootstrap" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="pull" depends="init" unless="skip.pull">
|
|
|
|
<!-- Pull the dependencies that Maven needs to build -->
|
|
|
|
<copy file="pom.xml" tofile="dependencies.xml" />
|
|
|
|
<replace file="${basedir}/dependencies.xml" token="<!--bootstrap-start-comment-->" value="<!--" />
|
|
|
|
<replace file="${basedir}/dependencies.xml" token="<!--bootstrap-end-comment-->" value="-->" />
|
2010-09-29 14:41:03 -04:00
|
|
|
<artifact:pom file="${basedir}/dependencies.xml" id="pom">
|
|
|
|
<localRepository path="${maven.repo.local}" />
|
|
|
|
</artifact:pom>
|
2009-12-08 14:04:03 -05:00
|
|
|
<artifact:dependencies pathId="pom.pathid" filesetId="pom.fileset" useScope="compile">
|
2009-05-25 02:40:34 -04:00
|
|
|
<localRepository path="${maven.repo.local}" />
|
|
|
|
<pom refid="pom" />
|
|
|
|
</artifact:dependencies>
|
|
|
|
<delete file="${basedir}/dependencies.xml" />
|
|
|
|
|
|
|
|
<!-- Pull the dependencies for Modello -->
|
2009-12-08 14:04:03 -05:00
|
|
|
<artifact:dependencies pathId="modello.pathid" filesetId="modello.fileset">
|
2009-05-25 02:40:34 -04:00
|
|
|
<localRepository path="${maven.repo.local}" />
|
|
|
|
<dependency groupId="org.codehaus.modello" artifactId="modello-maven-plugin" version="${pom.properties.modelloVersion}" />
|
|
|
|
</artifact:dependencies>
|
|
|
|
|
|
|
|
<!-- Pull the dependencies for the MetadataGenerator CLI -->
|
2009-12-08 14:04:03 -05:00
|
|
|
<artifact:dependencies pathId="pmdg.pathid" filesetId="pmdg.fileset">
|
2009-05-25 02:40:34 -04:00
|
|
|
<localRepository path="${maven.repo.local}" />
|
|
|
|
<dependency groupId="org.codehaus.plexus" artifactId="plexus-component-metadata" version="${pom.properties.plexusVersion}" />
|
|
|
|
</artifact:dependencies>
|
|
|
|
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="process-classes" depends="pull" description="generates plexus component metadata.">
|
|
|
|
<mkdir dir="${basedir}/bootstrap/target" />
|
|
|
|
<mkdir dir="${basedir}/bootstrap/target/classes" />
|
|
|
|
|
2009-12-08 14:04:03 -05:00
|
|
|
<path id="pmdg.classpath">
|
|
|
|
<path refid="maven.classpath" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<path refid="pmdg.pathid" />
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<echo>Using plexus version ${pom.properties.plexusVersion}</echo>
|
2010-08-10 08:24:17 -04:00
|
|
|
<java fork="true" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
|
2009-12-08 14:04:03 -05:00
|
|
|
<classpath refid="pmdg.classpath" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<!-- 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>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<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>
|
2010-08-10 08:24:17 -04:00
|
|
|
<java fork="true" classname="org.codehaus.modello.ModelloCli" failonerror="true">
|
2009-05-25 02:40:34 -04:00
|
|
|
<classpath refid="modello.pathid" />
|
|
|
|
<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 -->
|
|
|
|
</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>
|
|
|
|
|
2010-05-31 07:20:35 -04:00
|
|
|
<macrodef name="modello-ex">
|
|
|
|
<attribute name="file" />
|
|
|
|
<attribute name="version" default="1.0.0" />
|
|
|
|
<sequential>
|
|
|
|
<modello file="@{file}" version="@{version}" />
|
|
|
|
<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-extended-reader" />
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
|
|
|
|
|
|
|
<modello-ex file="maven-model/src/main/mdo/maven.mdo" version="4.0.0" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo" />
|
|
|
|
<modello file="maven-model-builder/src/main/mdo/profiles.mdo" />
|
2009-10-22 13:59:26 -04:00
|
|
|
<modello file="maven-settings/src/main/mdo/settings.mdo" version="1.1.0" />
|
2014-11-02 15:48:01 -05:00
|
|
|
<modello file="maven-core/src/main/mdo/toolchains.mdo" version="1.1.0" />
|
2010-08-24 18:46:07 -04:00
|
|
|
<modello file="maven-repository-metadata/src/main/mdo/metadata.mdo" version="1.1.0" />
|
2009-08-21 09:07:32 -04:00
|
|
|
<modello file="maven-compat/src/main/mdo/profiles.mdo" />
|
2009-08-21 11:04:07 -04:00
|
|
|
<modello file="maven-compat/src/main/mdo/paramdoc.mdo" />
|
2015-02-20 14:45:06 -05:00
|
|
|
<modello file="maven-embedder/src/main/mdo/core-extensions.mdo" />
|
2009-05-25 02:40:34 -04:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="compile-boot" depends="generate-sources" description="compiles the bootstrap sources">
|
|
|
|
<path id="sources">
|
|
|
|
<dirset dir=".">
|
|
|
|
<include name="bootstrap/target/generated-sources" />
|
2009-12-08 14:04:03 -05:00
|
|
|
<include name="*/src/main/java" />
|
2009-05-25 02:40:34 -04:00
|
|
|
</dirset>
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<mkdir dir="bootstrap/target/classes" />
|
2014-01-06 05:19:53 -05:00
|
|
|
<javac destdir="bootstrap/target/classes" encoding="UTF-8" source="1.6" target="1.6" debug="true" includeAntRuntime="false">
|
2009-05-25 02:40:34 -04:00
|
|
|
<src refid="sources" />
|
|
|
|
<classpath refid="pom.pathid" />
|
|
|
|
</javac>
|
|
|
|
|
2011-01-05 13:28:00 -05:00
|
|
|
<copy todir="bootstrap/target/classes" encoding="ISO-8859-1">
|
|
|
|
<fileset dir="maven-core/src/main/resources">
|
|
|
|
<include name="**/build.properties" />
|
|
|
|
</fileset>
|
|
|
|
<filterset begintoken="${" endtoken="}">
|
|
|
|
<filter token="project.version" value="${xmlPom.project.version}"/>
|
|
|
|
</filterset>
|
|
|
|
</copy>
|
|
|
|
<echo file="bootstrap/target/classes/META-INF/maven/org.apache.maven/maven-core/pom.properties" encoding="ISO-8859-1">
|
|
|
|
version = ${xmlPom.project.version}
|
|
|
|
</echo>
|
|
|
|
|
2009-05-25 02:40:34 -04:00
|
|
|
<path id="maven.classpath">
|
|
|
|
<pathelement location="bootstrap/target/classes" />
|
2009-12-08 14:04:03 -05:00
|
|
|
<dirset dir=".">
|
|
|
|
<include name="*/src/main/resources" />
|
|
|
|
</dirset>
|
2009-05-25 02:40:34 -04:00
|
|
|
<path refid="pom.pathid" />
|
|
|
|
</path>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
2012-12-14 09:29:00 -05:00
|
|
|
<java fork="${maven-compile.fork}" classname="org.apache.maven.cli.MavenCli" failonerror="true" timeout="600000" maxmemory="${maven-compile.maxmemory}">
|
2009-12-08 14:04:03 -05:00
|
|
|
<!--jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/-->
|
2012-12-14 09:29:00 -05:00
|
|
|
<!--jvmarg value="${maven-compile.jvmargs}"/-->
|
2009-05-25 02:40:34 -04:00
|
|
|
<classpath refid="maven.classpath" />
|
|
|
|
<arg value="${maven.debug}" />
|
|
|
|
<arg value="-B" />
|
2010-01-20 19:24:42 -05:00
|
|
|
<arg value="-V" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<arg value="clean" />
|
2010-11-23 10:36:02 -05:00
|
|
|
<arg value="${maven.goal}" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<arg value="-Dmaven.test.skip=${maven.test.skip}" />
|
2010-08-26 05:46:46 -04:00
|
|
|
<arg value="-DskipTests=${skipTests}" />
|
2009-05-25 02:40:34 -04:00
|
|
|
<arg value="-Dmaven.repo.local=${maven.repo.local}" />
|
|
|
|
<arg value="-Dsurefire.useFile=${surefire.useFile}" />
|
2009-06-20 15:54:26 -04:00
|
|
|
<arg value="-Dmaven.test.redirectTestOutputToFile=${maven.test.redirectTestOutputToFile}" />
|
2011-07-28 13:11:26 -04:00
|
|
|
<arg value="-DdistributionId=${distributionId}" />
|
|
|
|
<arg value="-DdistributionShortName=${distributionShortName}" />
|
2011-07-28 12:46:23 -04:00
|
|
|
<arg value="-DdistributionName=${distributionName}" />
|
2009-05-25 02:40:34 -04:00
|
|
|
</java>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="maven-assembly" depends="maven-compile" description="generates the Maven installation assembly using the bootstrap Maven">
|
|
|
|
<echo>
|
2009-05-25 01:26:27 -04:00
|
|
|
The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
|
|
|
|
This goal just validates the presence of that distribution.
|
|
|
|
</echo>
|
2009-05-25 02:40:34 -04:00
|
|
|
<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>
|
|
|
|
|
2010-05-08 14:43:13 -04:00
|
|
|
<target name="extract-assembly" depends="init,prompt-maven-home-exists,maven-assembly" description="extracts the maven assembly into maven.home">
|
2010-05-08 14:04:28 -04:00
|
|
|
<echo>Extracting assembly to ${maven.home} ...</echo>
|
2009-05-25 02:40:34 -04:00
|
|
|
<!-- If we are starting from scratch make sure the directory is created -->
|
2010-05-08 14:04:28 -04:00
|
|
|
<delete dir="${maven.home}" />
|
|
|
|
<mkdir dir="${maven.home}" />
|
|
|
|
<unzip src="${maven.assembly}" dest="${maven.home}">
|
|
|
|
<mapper type="regexp" from="^[^\\/]+[\\/](.*)$$" to="\1" />
|
|
|
|
</unzip>
|
2009-05-25 02:40:34 -04:00
|
|
|
<chmod perm="+x">
|
2010-05-08 14:04:28 -04:00
|
|
|
<fileset dir="${maven.home}/bin">
|
2009-05-25 02:40:34 -04:00
|
|
|
<include name="mvn" />
|
2011-09-01 11:01:43 -04:00
|
|
|
<include name="mvnDebug" />
|
|
|
|
<include name="mvnyjp" />
|
2009-05-25 02:40:34 -04:00
|
|
|
</fileset>
|
|
|
|
</chmod>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="all" depends="clean-bootstrap,init,extract-assembly" />
|
2009-02-17 16:46:38 -05:00
|
|
|
|
2006-10-11 02:23:43 -04:00
|
|
|
</project>
|