mirror of https://github.com/apache/maven.git
o if you have m2_home it does not to be named after the version
o works with a symlinked m2_home git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@648474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8aa6300529
commit
4c0d0199f5
96
build.xml
96
build.xml
|
@ -19,20 +19,6 @@ under the License.
|
|||
|
||||
<project default="all" basedir="." xmlns:artifact="urn:maven-artifact-ant">
|
||||
|
||||
<description>
|
||||
The first time you build Maven from source, you have to build Maven without Maven.
|
||||
This Ant script builds a minimal Maven, just enough to re-launch Maven again in this
|
||||
directory and generate an installation assembly. Then we extract the assembly and
|
||||
re-run the Maven build one more time, this time with the full generated Maven.
|
||||
|
||||
To run this script, you must set the M2_HOME environment variable or the maven.home
|
||||
property to the location that should contain Maven. This directory *must* be named
|
||||
after the maven version you want to install, e.g. /usr/local/apache-maven-2.1-SNAPSHOT.
|
||||
|
||||
You can set the maven.repo.local property to specify a custom location for your
|
||||
local repository for the bootstrap process.
|
||||
</description>
|
||||
|
||||
<target name="initTaskDefs">
|
||||
<xmlproperty file="pom.xml" prefix="pom.xml" />
|
||||
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.0.8.jar"/>
|
||||
|
@ -47,26 +33,11 @@ under the License.
|
|||
<fail unless="maven.home" message="You must set the M2_HOME environment variable or specify a maven.home property to this Ant script"/>
|
||||
</target>
|
||||
|
||||
<target name="checkMavenHome" depends="isMavenHomeSet">
|
||||
<target name="init" depends="isMavenHomeSet">
|
||||
<xmlproperty prefix="pom" file="pom.xml"/>
|
||||
<basename file="${maven.home}" property="maven.home.basename"/>
|
||||
<dirname file="${maven.home}" property="maven.home.dirname"/>
|
||||
<xmlproperty prefix="pom" file="pom.xml"/>
|
||||
<property name="maven.home.basename.expected" value="apache-maven-${pom.project.version}"/>
|
||||
<property name="maven.home.recommended" location="${maven.home.dirname}/${maven.home.basename.expected}"/>
|
||||
<condition property="build.failed">
|
||||
<not>
|
||||
<equals arg1="${maven.home.basename}" arg2="${maven.home.basename.expected}"/>
|
||||
</not>
|
||||
</condition>
|
||||
<fail if="build.failed">
|
||||
The Maven install destination directory must end with '${maven.home.basename.expected}'.
|
||||
Your M2_HOME was = ${maven.home}
|
||||
We recommend = ${maven.home.recommended}
|
||||
</fail>
|
||||
<echo message="maven.home=${maven.home}"/>
|
||||
</target>
|
||||
|
||||
<target name="init" depends="checkMavenHome">
|
||||
</target>
|
||||
|
||||
<target name="clean-bootstrap" description="cleans up generated bootstrap classes">
|
||||
|
@ -75,7 +46,7 @@ under the License.
|
|||
|
||||
<target name="pull" depends="init" unless="skip.pull">
|
||||
<property name="verbose" value="false"/>
|
||||
<property name="bootstrap.repository" value="${basedir}/bootstrap/repository"/>
|
||||
<property name="bootstrap.repository" value="${basedir}/bootstrap-repository"/>
|
||||
<!-- Pull the dependencies that Maven needs to build -->
|
||||
<copy file="pom.xml" tofile="dependencies.xml"/>
|
||||
<replace file="${basedir}/dependencies.xml" token="<!--start-->" value="<!--"/>
|
||||
|
@ -94,10 +65,8 @@ under the License.
|
|||
</artifact:dependencies>
|
||||
</target>
|
||||
|
||||
<target name="generate-sources" depends="pull"
|
||||
description="generates Java sources from Modello mdo model files">
|
||||
<target name="generate-sources" depends="pull" description="generates Java sources from Modello mdo model files">
|
||||
<mkdir dir="bootstrap/target"/>
|
||||
<mkdir dir="bootstrap/lib"/>
|
||||
<mkdir dir="bootstrap/target/generated-sources"/>
|
||||
|
||||
<macrodef name="modello-single-mode">
|
||||
|
@ -128,7 +97,6 @@ under the License.
|
|||
</macrodef>
|
||||
|
||||
<modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
|
||||
<!-- DGF TODO turn this into a big <apply> task? write a custom task? -->
|
||||
<modello file="maven-lifecycle/src/main/mdo/maven-lifecycle.mdo"/>
|
||||
<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
|
||||
<modello file="maven-profile/src/main/mdo/profiles.mdo"/>
|
||||
|
@ -137,20 +105,11 @@ under the License.
|
|||
</target>
|
||||
|
||||
<target name="compile-boot" depends="generate-sources" description="compiles the bootstrap sources">
|
||||
<echo>
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
COMPILE-BOOT
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
</echo>
|
||||
|
||||
<path id="sources">
|
||||
<dirset dir=".">
|
||||
<include name="bootstrap/target/generated-sources"/>
|
||||
<include name="*/src/main/*"/>
|
||||
<include name="maven-reporting/maven-reporting-api/src/main/*"/>
|
||||
<exclude name="maven-repository-tools/**"/>
|
||||
<exclude name="maven-core-it-verifier/**"/>
|
||||
</dirset>
|
||||
</path>
|
||||
|
@ -173,29 +132,16 @@ under the License.
|
|||
</path>
|
||||
</target>
|
||||
|
||||
<target name="maven-compile" depends="compile-boot"
|
||||
description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
||||
|
||||
<echo>
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
MAVEN-COMPILE
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
</echo>
|
||||
|
||||
<target name="maven-compile" depends="compile-boot" 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"/>
|
||||
<arg value="-e"/>
|
||||
<arg value="-B"/>
|
||||
<arg value="clean"/>
|
||||
<arg value="install"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="maven-assembly" depends="maven-compile"
|
||||
description="generates the Maven installation assembly using the bootstrap Maven">
|
||||
|
||||
<target name="maven-assembly" depends="maven-compile" description="generates the Maven installation assembly using the bootstrap Maven">
|
||||
<echo>
|
||||
The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
|
||||
This goal just validates the presence of that distribution.
|
||||
|
@ -206,14 +152,21 @@ under the License.
|
|||
<available file="${maven.assembly}"/>
|
||||
</not>
|
||||
</condition>
|
||||
<fail if="build.failed"
|
||||
message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
|
||||
<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">
|
||||
<target name="extract-assembly" depends="init,maven-assembly" description="extracts the maven assembly into maven.home">
|
||||
<echo>Extracting assembly to ${maven.home.dirname} ...</echo>
|
||||
<delete dir="${maven.home}"/>
|
||||
<!-- Deleting the contents inside maven.home allow one to use symlinks for maven.home and still have this work. -->
|
||||
<delete>
|
||||
<fileset dir="${maven.home}">
|
||||
<include name="bin"/>
|
||||
<include name="boot"/>
|
||||
<include name="conf"/>
|
||||
<include name="lib"/>
|
||||
<include name="*.txt"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<unzip src="${maven.assembly}" dest="${maven.home.dirname}"/>
|
||||
<chmod perm="+x">
|
||||
<fileset dir="${maven.home}/bin">
|
||||
|
@ -225,17 +178,4 @@ under the License.
|
|||
|
||||
<target name="all" depends="clean-bootstrap,init,extract-assembly"/>
|
||||
|
||||
<target name="run-full-maven" depends="all"
|
||||
description="runs the full extracted Maven, now with tests">
|
||||
<property name="maven.goals" value="test"/>
|
||||
<java classname="org.codehaus.classworlds.Launcher" fork="true" failonerror="true">
|
||||
<classpath>
|
||||
<fileset dir="${maven.home}/core/boot" includes="plexus-classworlds-*.jar"/>
|
||||
</classpath>
|
||||
<sysproperty key="classworlds.conf" value="${maven.home}/bin/m2.conf"/>
|
||||
<sysproperty key="maven.home" value="${maven.home}"/>
|
||||
<arg value="-e"/>
|
||||
<arg line="${maven.goals}"/>
|
||||
</java>
|
||||
</target>
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue