brett 2003/11/26 01:59:47 Modified: . Tag: MAVEN_RC2_UNSTABLE build-bootstrap.xml maven.xml project.properties src/bootstrap/org/apache/maven Tag: MAVEN_RC2_UNSTABLE BootstrapTask.java xdocs/misc Tag: MAVEN_RC2_UNSTABLE articles.xml Added: . Tag: MAVEN_RC2_UNSTABLE plugins-site.xml release.xml xdocs/project Tag: MAVEN_RC2_UNSTABLE initial-proposal.txt maven-resolution.txt Removed: . Tag: MAVEN_RC2_UNSTABLE build-bootstrap-core.xml initial-proposal.txt maven-resolution.txt Log: final merged from HEAD before branching for 1.0 Revision Changes Path No revision No revision 1.207.2.2 +44 -84 maven/build-bootstrap.xml Index: build-bootstrap.xml =================================================================== RCS file: /home/cvs/maven/build-bootstrap.xml,v retrieving revision 1.207.2.1 retrieving revision 1.207.2.2 diff -u -r1.207.2.1 -r1.207.2.2 --- build-bootstrap.xml 30 Oct 2003 11:24:41 -0000 1.207.2.1 +++ build-bootstrap.xml 26 Nov 2003 09:59:46 -0000 1.207.2.2 @@ -4,7 +4,6 @@ <property file="${user.home}/build.properties"/> <property file="${basedir}/project.properties"/> - <property file="${basedir}/build-bootstrap.properties"/> <property environment="env"/> <property name="maven.home" value="${env.MAVEN_HOME}"/> @@ -77,7 +76,7 @@ <bootstrap projectDescriptor="project.xml" baseUrl="${maven.get.jars.baseUrl}/" - mavenLocalRepo="${maven.repo.local}" + mavenRepoLocal="${maven.repo.local}" online="${maven.bootstrap.online}" proxyHost="${maven.proxy.host}" proxyUserName="${maven.proxy.username}" @@ -137,22 +136,6 @@ </fileset> </jar> - <!-- ===================================================================== --> - <!-- P H A S E 1 I N S T A L L --> - <!-- ===================================================================== --> - <!-- This will produce a functional Maven install. The only plugins that --> - <!-- are installed are the: --> - <!-- --> - <!-- a) java --> - <!-- b) test --> - <!-- c) touchstone --> - <!-- d) touchstone-partner --> - <!-- e) jar --> - <!-- f) clean --> - <!-- g) license --> - <!-- h) plugin --> - <!-- ===================================================================== --> - <echo> +------------------------------------------------------------------+ | | @@ -224,60 +207,34 @@ overwrite="yes" /> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/clean.jar" - basedir="src/plugins-build/clean"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/jar.jar" - basedir="src/plugins-build/jar"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/java.jar" - basedir="src/plugins-build/java"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/license.jar" - basedir="src/plugins-build/license"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/touchstone.jar" - basedir="src/plugins-build/touchstone"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/touchstone-partner.jar" - basedir="src/plugins-build/touchstone-partner"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/test.jar" - basedir="src/plugins-build/test"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> - <jar - jarfile="${maven.bootstrap.install.dir}/plugins/plugin.jar" - basedir="src/plugins-build/plugin"> - <exclude name="**/maven.xml"/> - <exclude name="**/target/**"/> - </jar> + <copy todir="${maven.bootstrap.install.dir}/plugins"> + <fileset dir="${maven.plugins.directory}"> + <include name="clean/**"/> + <include name="jar/**"/> + <include name="java/**"/> + <include name="test/**"/> + <include name="license/**"/> + <include name="touchstone/**"/> + <include name="touchstone-partner/**"/> + <include name="plugin/**"/> + <include name="project.xml"/> + <exclude name="**/maven.xml"/> + <exclude name="**/target/**"/> + </fileset> + </copy> <antcall target="clean-maven-home"/> <copy todir="${maven.home}"> <fileset dir="${maven.bootstrap.install.dir}"> - <!-- <exclude name="plugins/**" /> --> + <exclude name="plugins/**" /> + </fileset> + </copy> + + <!-- expanded plugins should be put in the maven.home.local --> + <copy todir="${maven.home.local}"> + <fileset dir="${maven.bootstrap.install.dir}"> + <include name="plugins/**" /> </fileset> </copy> @@ -314,17 +271,6 @@ <arg value="-e"/> </exec> - <!-- - <exec - executable="${maven.command}" - failonerror="true"> - <arg value="${maven.bootstrap.online}"/> - <arg value="java:jar"/> - <arg value="-e"/> - </exec> - --> - - <echo> +------------------------------------------------------------------+ | | @@ -337,8 +283,14 @@ <mkdir dir="${maven.bootstrap.install.dir}/plugins"/> <copy todir="${maven.bootstrap.install.dir}/plugins" flatten="yes"> - <fileset dir="src/plugins-build"> + <fileset dir="${maven.plugins.directory}"> <include name="**/target/maven*plugin*.jar"/> + + <!-- Exclude plugins no one can be using --> + <exclude name="**/target/maven-dependency-plugin*.jar"/> + <exclude name="**/target/maven-graph-plugin*.jar"/> + <exclude name="**/target/maven-jdiff-plugin*.jar"/> + <exclude name="**/target/maven-xdoclet-plugin*.jar"/> </fileset> </copy> @@ -374,11 +326,11 @@ overwrite="yes" /> - <copy - file="${basedir}/src/xsd/maven-project.xsd" - todir="${maven.bootstrap.install.dir}" - overwrite="yes" - /> + <copy todir="${maven.bootstrap.install.dir}" overwrite="yes"> + <fileset dir="${basedir}/src/xsd"> + <include name="maven-project.xsd"/> + </fileset> + </copy> <copy file="${basedir}/src/xsd/maven-navigation-1.0.xsd" @@ -393,6 +345,13 @@ <chmod file="${maven.home}/bin/maven" perm="+x"/> <!-- run plugin test projects --> + + <!-- + + This needs to be decoupled and moved and it appears to be + coupled to src/plugins-build. I will fix shortly but I want the + bootstrap to work in the interim. + <exec executable="${maven.command}" failonerror="true"> <arg value="-Dmaven.home.local=${maven.home.local}"/> <arg value="-Dmaven.repo.local=${maven.repo.local}"/> @@ -400,6 +359,7 @@ <arg value="clean"/> <arg value="maven:plugin-test"/> </exec> + --> </target> 1.94.2.2 +6 -242 maven/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/maven/maven.xml,v retrieving revision 1.94.2.1 retrieving revision 1.94.2.2 diff -u -r1.94.2.1 -r1.94.2.2 --- maven.xml 30 Oct 2003 11:26:38 -0000 1.94.2.1 +++ maven.xml 26 Nov 2003 09:59:46 -0000 1.94.2.2 @@ -53,7 +53,7 @@ description="Build each Maven plugin into an installable jar"> <maven:reactor - basedir="${maven.src.dir}/plugins-build" + basedir="${maven.plugins.directory}" includes="*/project.xml" excludes="examples/*" goals="clean,plugin" @@ -62,36 +62,11 @@ /> </goal> - <goal name="maven:plugins-install"> - <delete dir="${maven.home}/plugins"/> - <mkdir dir="${maven.home}/plugins"/> - - <copy todir="${maven.home}/plugins" flatten="yes"> - <fileset dir="src/plugins-build"> - <include name="**/target/maven*plugin*.jar"/> - </fileset> - </copy> - </goal> - - <goal - name="maven:core-plugins-build" - description="Build each Maven plugin into an installable jar"> - - <maven:reactor - basedir="${maven.src.dir}/plugins-build" - includes="clean/project.xml,jar/project.xml,java/project.xml,license/project.xml,plugin/project.xml,test/project.xml,touchstone/project.xml,touchstone-partner/project.xml" - excludes="examples/*" - goals="clean,plugin" - banner="Building" - ignoreFailures="false" - /> - </goal> - <goal name="maven:plugins-clean" description="Cleans all plugin projects"> <maven:reactor - basedir="${maven.src.dir}/plugins-build" + basedir="${maven.plugins.directory}" includes="*/project.xml" goals="clean" banner="Building" @@ -99,80 +74,18 @@ /> </goal> - <!-- - | - | Some goals to help with the release of Maven itself. - | - --> - - <goal name="pre-release-work"> - <attainGoal name="maven:plugin-increment-snapshot-version"/> - <attainGoal name="maven:plugin-convert-snapshots"/> - </goal> - - <goal name="maven:plugin-convert-snapshots" - description="Convert snapshot versions into resolved timestamped versions."> - - <maven:reactor - basedir="${maven.src.dir}/plugins-build" - includes="*/project.xml" - goals="convert-snapshots-auto" - banner="Resolving snapshot versions" - ignoreFailures="true" - /> - </goal> - - <goal name="maven:plugin-validate-pom-for-release" - description="Validate the Plugin POMs for release."> - - <maven:reactor - basedir="${maven.src.dir}/plugins-build" - includes="*/project.xml" - goals="validate-pom-for-release" - banner="Resolving snapshot versions" - ignoreFailures="false" - /> - </goal> - - <goal name="maven:plugin-increment-snapshot-version" - description="Graduate Plugin currentVersion element."> - - <maven:reactor - basedir="${maven.src.dir}/plugins-build" - includes="*/project.xml" - goals="increment-snapshot-version" - banner="Graduating snapshot version" - ignoreFailures="true" - /> - </goal> - - <!-- ================================================================== --> - <!-- G E N E R A T E P L U G I N D O C U M E N T A T I O N --> - <!-- ================================================================== --> - - <goal name="maven:plugin-docs" - description="Build each Maven plugin's documentation"> - - <maven:reactor - basedir="${maven.src.dir}/plugins-build" - includes="*/project.xml" - goals="xdoc" - banner="Generating Docs For" - ignoreFailures="false" - /> - - </goal> - <!-- ================================================================== --> <!-- R U N P L U G I N T E S T S --> <!-- ================================================================== --> + <!-- <goal name="maven:plugin-test"> <j:set var="maven.multiproject.includes" value="*/src/plugin-test/project.xml" /> <j:set var="goal" value="testPlugin"/> <attainGoal name="multiproject:goal" /> </goal> - + --> + <goal name="maven:jar-install" description="Compile Maven and put a new jar in ${maven.home}/lib."> <attainGoal name="jar:jar"/> @@ -203,153 +116,4 @@ --> </goal> - <!-- ================================================================== --> - <!-- M A V E N I N S T A L L E R --> - <!-- ================================================================== --> - - <property name="tag" value="${pom.artifactId}-${pom.currentVersion}"/> - - <goal name="maven:installer" description="Create a Maven installer jar"> - - <property name="installersDir" value="installers"/> - <property name="installersBase" value="${installersDir}/${tag}"/> - - <delete dir="${installersDir}"/> - <mkdir dir="${installersBase}"/> - - <copy todir="${installersBase}"> - <fileset dir="${maven.home}"> - <include name="plugins/*.jar"/> - <include name="bin/*"/> - <include name="lib/**"/> - <include name="maven-project.xsd"/> - </fileset> - </copy> - - <mkdir dir="${installersBase}/repository"/> - - <tar longfile="gnu" tarfile="${tag}.tar"> - <tarfileset dir="${installersDir}"> - <exclude name="**/maven"/> - </tarfileset> - <tarfileset dir="${installersDir}" mode="755"> - <include name="**/maven"/> - </tarfileset> - </tar> - - <gzip - zipfile="${tag}.tar.gz" - src="${tag}.tar" - /> - <copy - file="${maven.build.dir}/${maven.final.name}.jar" - todir="${maven.home}/plugins" - /> - - <delete file="${tag}.tar"/> - - <!-- Create a zip file --> - <zip zipfile="${tag}.zip"> - <zipfileset dir="${installersDir}"/> - </zip> - - </goal> - - <goal name="maven:installer-deploy" - description="Deploy an installable Maven jar to the remote repo??"> - - <maven:user-check user="${maven.username}"/> - <attainGoal name="maven:installer"/> - - <tar longfile="gnu" tarfile="installers.tar"> - <tarfileset dir="${basedir}"> - <include name="${tag}.tar.gz"/> - <include name="${tag}.zip"/> - </tarfileset> - </tar> - - <deploy:artifact - artifact="installers.tar" - type="distributions" - assureDirectoryCommand="mkdir -p" - siteCommand="cd @deployDirectory@;tar xUvf installers.tar;chmod -R g+u *;rm installers.tar" - /> - - </goal> - - <!-- - These two goals are the start of the merge of plugin docs and - the main maven documentation. pre-xdoc-transform will be changed - from a 'goal' to a 'preGoal' on 'xdoc:transform'. - 'postSite' will be changed to a 'postGoal' on 'site'. - - Plugin docs will generated and then copied into - target/docs/reference/plugins/${plugin}/ - - A simple home page listing the plugins and linking to their - docs will be generated in pre xdoc:transform, and processed into - target/docs/reference/plugins/index.html - --> - - <preGoal name="xdoc:transform"> - <attainGoal name="multiproject:create-overview-page"/> - </preGoal> - - <preGoal name="xdoc"> - <j:if test="${pluginSite != null}"> - - <maven:reactor - basedir="${basedir}" - includes="src/plugins-build/*/project.xml" - goals="site" - banner="Generating site for" - ignoreFailures="false" - /> - - <!-- create the parent directory for the docs --> - <mkdir dir="${maven.docs.dest}/reference/plugins" /> - - <!-- copy them all to ${maven.docs.dest}/reference/plugins/${plugin.id}/ --> - <ant:fileScanner var="pluginProjects"> - <fileset dir="${basedir}"> - <include name="src/plugins-build/*/project.xml" /> - </fileset> - </ant:fileScanner> - <j:forEach items="${pluginProjects.iterator()}" var="plugin"> - <j:set var="pluginName" value="${plugin.parentFile.name}" /> - <mkdir dir="${maven.docs.dest}/reference/plugins/${pluginName}/" /> - <copy toDir="${maven.docs.dest}/reference/plugins/${pluginName}/"> - <fileset dir="src/plugins-build/${pluginName}/target/docs/"> - <include name="**" /> - </fileset> - </copy> - </j:forEach> - </j:if> - </preGoal> - - <!-- ================================================================== --> - <!-- M A V E N D I S T R I B U T I O N T E S T A I D S --> - <!-- ================================================================== --> - <!-- NOTE: --> - <!-- Make sure you get rid of as many (all ideally) SNAPSHOT jars --> - <!-- as possible. --> - <!-- ================================================================== --> - <!-- 1. (Re)move current Maven installation --> - <!-- 2. Bootstrap --> - <!-- 3. maven maven:installer --> - <!-- 4. Install maven (with the freshly created installer) --> - <!-- 5. maven --> - <!-- 6. maven site --> - <!-- ================================================================== --> - - <postGoal name="java:jar-resources"> - <j:if test="${maven.test.distribution}"> - <echo>Using test log4j.properties file ...</echo> - <copy - file="src/test/log4j.properties" - todir="${maven.build.dest}" - overwrite="true" - /> - </j:if> - </postGoal> - </project> +</project> 1.49.2.1 +39 -1 maven/project.properties Index: project.properties =================================================================== RCS file: /home/cvs/maven/project.properties,v retrieving revision 1.49 retrieving revision 1.49.2.1 diff -u -r1.49 -r1.49.2.1 --- project.properties 28 Oct 2003 00:11:28 -0000 1.49 +++ project.properties 26 Nov 2003 09:59:46 -0000 1.49.2.1 @@ -67,4 +67,42 @@ #------------------------------------------------------------------ # H T M L 2 X D O C P R O P E R T I E S #------------------------------------------------------------------ -maven.html2xdoc.enable=true \ No newline at end of file +maven.html2xdoc.enable=true + +#------------------------------------------------------------------ +# B O O T S T R A P +#------------------------------------------------------------------ + +maven.bootstrap.plugins = clean/**,jar/**,java/**,license/**,plugin/**,test/**,touchstone/**,touchstone-partner/** +maven.bootstrap.reactor = clean/project.xml,jar/project.xml,java/project.xml,license/project.xml,plugin/project.xml,touchstone/project.xml,touchstone-partner/project.xml +maven.plugins.directory = ${basedir}/../maven-plugins + +maven.get.jars.baseUrl = http://www.ibiblio.org/maven +maven.bootstrap.dir = ${basedir}/bootstrap + +# ------------------------------------------------------------------------------ +# bootstrap is offline or online - online by default . Pass this property +# as -o from the command prompt if you are offline +# Online mode: +# maven.bootstrap.online = +# Offline mode: +# maven.bootstrap.online = -o +# ------------------------------------------------------------------------------ +maven.bootstrap.online= + +# ------------------------------------------------------------------------------ +# The bootstrap classes consist of an Ant task front that: +# +# a) parses the POM using a simple subclass of DefaultHandler +# b) downloads Maven's dependencies +# ------------------------------------------------------------------------------ +maven.bootstrap.classes = ${maven.bootstrap.dir}/bootstrap-classes + +# ------------------------------------------------------------------------------ +# The phase1 classes are all the Maven classes compiled using Ant instead +# of Maven itself. +# ------------------------------------------------------------------------------ +maven.bootstrap.phase1.classes = ${maven.bootstrap.dir}/phase1-classes + +maven.bootstrap.install.dir = ${maven.bootstrap.dir}/install-phase1 +maven.bootstrap.bin.dir = ${maven.bootstrap.dir}/bin No revision Index: project.properties =================================================================== RCS file: /home/cvs/maven/project.properties,v retrieving revision 1.49 retrieving revision 1.49.2.1 diff -u -r1.49 -r1.49.2.1 --- project.properties 28 Oct 2003 00:11:28 -0000 1.49 +++ project.properties 26 Nov 2003 09:59:46 -0000 1.49.2.1 @@ -67,4 +67,42 @@ #------------------------------------------------------------------ # H T M L 2 X D O C P R O P E R T I E S #------------------------------------------------------------------ -maven.html2xdoc.enable=true \ No newline at end of file +maven.html2xdoc.enable=true + +#------------------------------------------------------------------ +# B O O T S T R A P +#------------------------------------------------------------------ + +maven.bootstrap.plugins = clean/**,jar/**,java/**,license/**,plugin/**,test/**,touchstone/**,touchstone-partner/** +maven.bootstrap.reactor = clean/project.xml,jar/project.xml,java/project.xml,license/project.xml,plugin/project.xml,touchstone/project.xml,touchstone-partner/project.xml +maven.plugins.directory = ${basedir}/../maven-plugins + +maven.get.jars.baseUrl = http://www.ibiblio.org/maven +maven.bootstrap.dir = ${basedir}/bootstrap + +# ------------------------------------------------------------------------------ +# bootstrap is offline or online - online by default . Pass this property +# as -o from the command prompt if you are offline +# Online mode: +# maven.bootstrap.online = +# Offline mode: +# maven.bootstrap.online = -o +# ------------------------------------------------------------------------------ +maven.bootstrap.online= + +# ------------------------------------------------------------------------------ +# The bootstrap classes consist of an Ant task front that: +# +# a) parses the POM using a simple subclass of DefaultHandler +# b) downloads Maven's dependencies +# ------------------------------------------------------------------------------ +maven.bootstrap.classes = ${maven.bootstrap.dir}/bootstrap-classes + +# ------------------------------------------------------------------------------ +# The phase1 classes are all the Maven classes compiled using Ant instead +# of Maven itself. +# ------------------------------------------------------------------------------ +maven.bootstrap.phase1.classes = ${maven.bootstrap.dir}/phase1-classes + +maven.bootstrap.install.dir = ${maven.bootstrap.dir}/install-phase1 +maven.bootstrap.bin.dir = ${maven.bootstrap.dir}/bin No revision Index: project.properties =================================================================== RCS file: /home/cvs/maven/project.properties,v retrieving revision 1.49 retrieving revision 1.49.2.1 diff -u -r1.49 -r1.49.2.1 --- project.properties 28 Oct 2003 00:11:28 -0000 1.49 +++ project.properties 26 Nov 2003 09:59:46 -0000 1.49.2.1 @@ -67,4 +67,42 @@ #------------------------------------------------------------------ # H T M L 2 X D O C P R O P E R T I E S #------------------------------------------------------------------ -maven.html2xdoc.enable=true \ No newline at end of file +maven.html2xdoc.enable=true + +#------------------------------------------------------------------ +# B O O T S T R A P +#------------------------------------------------------------------ + +maven.bootstrap.plugins = clean/**,jar/**,java/**,license/**,plugin/**,test/**,touchstone/**,touchstone-partner/** +maven.bootstrap.reactor = clean/project.xml,jar/project.xml,java/project.xml,license/project.xml,plugin/project.xml,touchstone/project.xml,touchstone-partner/project.xml +maven.plugins.directory = ${basedir}/../maven-plugins + +maven.get.jars.baseUrl = http://www.ibiblio.org/maven +maven.bootstrap.dir = ${basedir}/bootstrap + +# ------------------------------------------------------------------------------ +# bootstrap is offline or online - online by default . Pass this property +# as -o from the command prompt if you are offline +# Online mode: +# maven.bootstrap.online = +# Offline mode: +# maven.bootstrap.online = -o +# ------------------------------------------------------------------------------ +maven.bootstrap.online= + +# ------------------------------------------------------------------------------ +# The bootstrap classes consist of an Ant task front that: +# +# a) parses the POM using a simple subclass of DefaultHandler +# b) downloads Maven's dependencies +# ------------------------------------------------------------------------------ +maven.bootstrap.classes = ${maven.bootstrap.dir}/bootstrap-classes + +# ------------------------------------------------------------------------------ +# The phase1 classes are all the Maven classes compiled using Ant instead +# of Maven itself. +# ------------------------------------------------------------------------------ +maven.bootstrap.phase1.classes = ${maven.bootstrap.dir}/phase1-classes + +maven.bootstrap.install.dir = ${maven.bootstrap.dir}/install-phase1 +maven.bootstrap.bin.dir = ${maven.bootstrap.dir}/bin 1.1.2.1 +0 -0 maven/plugins-site.xml Index: plugins-site.xml =================================================================== RCS file: /home/cvs/maven/plugins-site.xml,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 1.1.2.1 +0 -0 maven/release.xml Index: release.xml =================================================================== RCS file: /home/cvs/maven/release.xml,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 No revision No revision 1.17.2.1 +172 -184 maven/src/bootstrap/org/apache/maven/BootstrapTask.java Index: BootstrapTask.java =================================================================== RCS file: /home/cvs/maven/src/bootstrap/org/apache/maven/BootstrapTask.java,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -r1.17 -r1.17.2.1 --- BootstrapTask.java 4 Sep 2003 14:36:51 -0000 1.17 +++ BootstrapTask.java 26 Nov 2003 09:59:46 -0000 1.17.2.1 @@ -55,81 +55,54 @@ * * ==================================================================== */ -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ArrayList; import org.apache.maven.util.HttpUtils; - import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.PatternSet; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * Get a list of resources from a website. * * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> */ public class BootstrapTask - extends Task + extends Task { private BootstrapPomParser bootstrapPomParser; + private File projectDescriptor; + private List dependencies; - private File mavenLocalRepo; - // http retrieval - /** - * Whether verbose logging should be performed - */ - private boolean verbose = false; - - /** - * whether the remote timestamp should be placed on the download file - */ + private File mavenRepoLocal; + private boolean useTimestamp = true; - - /** - * whether the task should fail on a HTTP error - */ + private boolean ignoreErrors = true; - - /** - * A URL that the files are relative to - */ + private String baseUrl; - - /** whether bootstrap is online */ + private String online; - - /** - * Proxy host - */ + private String proxyHost; - - /** - * Proxy port - */ + private String proxyPort; - - /** - * Proxy userName - */ + private String proxyUserName; - - /** - * Proxy password - */ + private String proxyPassword; - + /** list of files to process */ private List files; @@ -140,7 +113,8 @@ * Get the directory to put the copy script into. * @return the directory */ - public File getCopyScriptDir() { + public File getCopyScriptDir() + { return copyScriptDir; } @@ -148,14 +122,15 @@ * Set the directory to put the copy script into. * @param copyScriptDir the copy script directory */ - public void setCopyScriptDir(File copyScriptDir) { + public void setCopyScriptDir( File copyScriptDir ) + { this.copyScriptDir = copyScriptDir; } /** * Sets the projectDescriptor attribute of the BootstrapTask object */ - public void setProjectDescriptor(File projectDescriptor) + public void setProjectDescriptor( File projectDescriptor ) { this.projectDescriptor = projectDescriptor; } @@ -171,17 +146,17 @@ /** * Sets the basedir attribute of the BootstrapTask object */ - public void setMavenLocalRepo(File mavenLocalRepo) + public void setMavenRepoLocal( File mavenRepoLocal ) { - this.mavenLocalRepo = mavenLocalRepo; + this.mavenRepoLocal = mavenRepoLocal; } /** * Gets the basedir attribute of the BootstrapTask object */ - public File getMavenLocalRepo() + public File getMavenRepoLocal() { - return mavenLocalRepo; + return mavenRepoLocal; } // http @@ -189,7 +164,7 @@ /** * Sets the files attribute of the BootstrapTask object */ - public void setFiles(List files) + public void setFiles( List files ) { this.files = files; } @@ -207,7 +182,7 @@ * * @param baseUrl A URL that the files are relative to */ - public void setBaseUrl(String baseUrl) + public void setBaseUrl( String baseUrl ) { this.baseUrl = baseUrl; } @@ -217,12 +192,12 @@ * * @param proxyHost the host name of the proxy */ - public void setProxyHost(String proxyHost) + public void setProxyHost( String proxyHost ) { - if (validProperty(proxyHost)) + if ( validProperty( proxyHost ) ) { this.proxyHost = proxyHost; - } + } } /** @@ -230,12 +205,12 @@ * * @param proxyPort the port used to access the proxy, e.g. <code>8080</code> */ - public void setProxyPort(String proxyPort) + public void setProxyPort( String proxyPort ) { - if (validProperty(proxyPort)) + if ( validProperty( proxyPort ) ) { this.proxyPort = proxyPort; - } + } } /** @@ -243,12 +218,12 @@ * * @param proxyUserName the login used to access the proxy */ - public void setProxyUserName(String proxyUserName) - { - if (validProperty(proxyUserName)) + public void setProxyUserName( String proxyUserName ) + { + if ( validProperty( proxyUserName ) ) { this.proxyUserName = proxyUserName; - } + } } /** @@ -256,22 +231,12 @@ * * @param proxyPassword the password used to access the proxy, e.g. <code>8080</code> */ - public void setProxyPassword(String proxyPassword) + public void setProxyPassword( String proxyPassword ) { - if (validProperty(proxyPassword)) + if ( validProperty( proxyPassword ) ) { this.proxyPassword = proxyPassword; - } - } - - /** - * Be verbose, if set to "<CODE>true</CODE>". - * - * @param v if "true" then be verbose - */ - public void setVerbose(boolean v) - { - verbose = v; + } } /** @@ -279,7 +244,7 @@ * * @param v if "true" then don't report download errors up to ant */ - public void setIgnoreErrors(boolean v) + public void setIgnoreErrors( boolean v ) { ignoreErrors = v; } @@ -299,7 +264,7 @@ * * @param v "true" to enable file time fetching */ - public void setUseTimestamp(boolean v) + public void setUseTimestamp( boolean v ) { useTimestamp = v; } @@ -312,47 +277,58 @@ public void execute() throws BuildException { - if (baseUrl == null) + if ( baseUrl == null ) { - throw new BuildException("baseUrl attribute is required"); + throw new BuildException( "baseUrl attribute is required" ); } - if (mavenLocalRepo == null) + if ( mavenRepoLocal == null ) { - throw new BuildException("mavenLocalRepo attribute is required"); + throw new BuildException( "mavenRepoLocal attribute is required" ); } - if (mavenLocalRepo.exists() && !mavenLocalRepo.canWrite()) + if ( mavenRepoLocal.exists() && !mavenRepoLocal.canWrite() ) { - throw new BuildException("Can't write to " - + mavenLocalRepo.getAbsolutePath()); + throw new BuildException( "Can't write to " + + mavenRepoLocal.getAbsolutePath() ); } - + + System.out.println( "Using the following for your maven.repo.local: " + mavenRepoLocal ); + bootstrapPomParser = new BootstrapPomParser(); - bootstrapPomParser.parse(getProjectDescriptor()); + + bootstrapPomParser.parse( getProjectDescriptor() ); + dependencies = bootstrapPomParser.getDependencies(); List list = new ArrayList(); - for (Iterator i = dependencies.iterator(); i.hasNext(); ) + + for ( Iterator i = dependencies.iterator(); i.hasNext(); ) { Dependency d = (Dependency) i.next(); - list.add(getArtifactPath(d, "/")); + + list.add( getArtifactPath( d, "/" ) ); } - - setFiles(list); + + setFiles( list ); // if offline is not set, download dependencies - if ( "-o".equals(getOnline()) == false ) + if ( "-o".equals( getOnline() ) == false ) { downloadDependencies(); } - - createClasspathReference(project, "bootstrap-classpath", list, mavenLocalRepo); - createPatternSetReference(project, "bootstrap-patternset", list); - try { + + createClasspathReference( project, "bootstrap-classpath", list, mavenRepoLocal ); + + createPatternSetReference( project, "bootstrap-patternset", list ); + + try + { createDependencyCopyScript(); - } catch (IOException e) { + } + catch ( IOException e ) + { // ignore this - if the script is missing the maven script will work as before - log("Problem writing copy script: " + e, Project.MSG_WARN); + log( "Problem writing copy script: " + e, Project.MSG_WARN ); } } @@ -362,59 +338,59 @@ * @todo this should be generated through some sort of template. * @throws IOException if there is a problem writing the script file */ - private void createDependencyCopyScript() throws IOException + private void createDependencyCopyScript() throws IOException { - if (copyScriptDir == null) + if ( copyScriptDir == null ) { - log("Not making the copy script - no directory given to bootstrap task", Project.MSG_DEBUG); - return; + log( "Not making the copy script - no directory given to bootstrap task", Project.MSG_DEBUG ); + return; } - PrintWriter shell = new PrintWriter(new FileWriter(new File(copyScriptDir, "install_repo.sh"))); - shell.print("#!/bin/sh\n"); - shell.print("REPO_DIR=$1\n"); - shell.print("if [ -z \"$REPO_DIR\" ]; then echo \"usage: $0 [repository directory]\"; exit; fi\n"); - shell.print("if [ -z \"$MAVEN_HOME\" ]; then echo \"MAVEN_HOME must be set\"; exit; fi\n"); - PrintWriter batch = new PrintWriter(new FileWriter(new File(copyScriptDir, "install_repo.bat"))); - batch.print("@ECHO OFF\r\n"); - batch.print("if \"%1\"==\"\" goto usage\r\n"); - batch.print("set REPO_DIR=%1\r\n"); - batch.print("if \"%MAVEN_HOME%\"==\"\" goto MHusage\r\n"); - for (Iterator i = dependencies.iterator(); i.hasNext(); ) + PrintWriter shell = new PrintWriter( new FileWriter( new File( copyScriptDir, "install_repo.sh" ) ) ); + shell.print( "#!/bin/sh\n" ); + shell.print( "REPO_DIR=$1\n" ); + shell.print( "if [ -z \"$REPO_DIR\" ]; then echo \"usage: $0 [repository directory]\"; exit; fi\n" ); + shell.print( "if [ -z \"$MAVEN_HOME\" ]; then echo \"MAVEN_HOME must be set\"; exit; fi\n" ); + PrintWriter batch = new PrintWriter( new FileWriter( new File( copyScriptDir, "install_repo.bat" ) ) ); + batch.print( "@ECHO OFF\r\n" ); + batch.print( "if \"%1\"==\"\" goto usage\r\n" ); + batch.print( "set REPO_DIR=%1\r\n" ); + batch.print( "if \"%MAVEN_HOME%\"==\"\" goto MHusage\r\n" ); + for ( Iterator i = dependencies.iterator(); i.hasNext(); ) { Dependency d = (Dependency) i.next(); - String path = getArtifactPath(d, "/"); + String path = getArtifactPath( d, "/" ); shell.print( "if [ ! -f $REPO_DIR/" - + path - + " ]; then mkdir -p $REPO_DIR/" - + d.getArtifactDirectory() - + "/jars; cp $MAVEN_HOME/lib/"); - if (d.getArtifactDirectory().equals("xml-apis") || - d.getArtifactDirectory().equals("xerces")) + + path + + " ]; then mkdir -p $REPO_DIR/" + + d.getArtifactDirectory() + + "/jars; cp $MAVEN_HOME/lib/" ); + if ( d.getArtifactDirectory().equals( "xml-apis" ) || + d.getArtifactDirectory().equals( "xerces" ) ) { - shell.print("endorsed/"); + shell.print( "endorsed/" ); } - shell.print(d.getArtifact() + " $REPO_DIR/" + path + "; fi\n"); + shell.print( d.getArtifact() + " $REPO_DIR/" + path + "; fi\n" ); path = "%REPO_DIR%\\" + d.getArtifactDirectory() + "\\jars"; - batch.print("if not exist " + path + " mkdir " + path + "\r\n"); - path = getArtifactPath(d, "\\"); + batch.print( "if not exist " + path + " mkdir " + path + "\r\n" ); + path = getArtifactPath( d, "\\" ); batch.print( "if not exist \"%REPO_DIR%\\" - + path - + "\" copy \"%MAVEN_HOME%\\lib\\"); - if (d.getArtifactDirectory().equals("xml-apis") || - d.getArtifactDirectory().equals("xerces")) + + path + + "\" copy \"%MAVEN_HOME%\\lib\\" ); + if ( d.getArtifactDirectory().equals( "xml-apis" ) || + d.getArtifactDirectory().equals( "xerces" ) ) { - batch.print("endorsed\\"); + batch.print( "endorsed\\" ); } - batch.print(d.getArtifact() + "\" \"%REPO_DIR%\\" + path + "\"\r\n"); + batch.print( d.getArtifact() + "\" \"%REPO_DIR%\\" + path + "\"\r\n" ); } - batch.print("goto end\r\n"); - batch.print(":MHusage\r\n"); - batch.print("echo MAVEN_HOME must be set\r\n"); - batch.print(":usage\r\n"); - batch.print("echo usage: %0 [repository directory]\r\n"); - batch.print(":end\r\n"); + batch.print( "goto end\r\n" ); + batch.print( ":MHusage\r\n" ); + batch.print( "echo MAVEN_HOME must be set\r\n" ); + batch.print( ":usage\r\n" ); + batch.print( "echo usage: %0 [repository directory]\r\n" ); + batch.print( ":end\r\n" ); shell.close(); batch.close(); } @@ -424,7 +400,7 @@ * @param d the dependency * @return the path to the dependency */ - private String getArtifactPath(Dependency d, String pathSeparator) + private String getArtifactPath( Dependency d, String pathSeparator ) { return d.getArtifactDirectory() + pathSeparator + "jars" + pathSeparator + d.getArtifact(); } @@ -437,52 +413,63 @@ public void downloadDependencies() throws BuildException { - for (Iterator j = getFiles().iterator(); j.hasNext(); ) + for ( Iterator j = getFiles().iterator(); j.hasNext(); ) { try { String file = (String) j.next(); - File destinationFile = new File(mavenLocalRepo, file); + + File destinationFile = new File( mavenRepoLocal, file ); // The directory structure for this project may // not exists so create it if missing. File directory = destinationFile.getParentFile(); - if (directory.exists() == false) + + if ( directory.exists() == false ) { directory.mkdirs(); } + if ( destinationFile.exists() ) + { + log( "Destination file " + destinationFile + " exists. Not dowloading." ); + + continue; + } + log( "Downloading dependency: " + baseUrl + file ); int numRetries = 3; + while ( numRetries >= 0 ) { try { - HttpUtils.getFile( baseUrl + file, - destinationFile, - ignoreErrors, - useTimestamp, - proxyHost, - proxyPort, + HttpUtils.getFile( baseUrl + file, + destinationFile, + ignoreErrors, + useTimestamp, + proxyHost, + proxyPort, proxyUserName, - proxyPassword); + proxyPassword ); break; } - catch (Exception e) + catch ( Exception e ) { numRetries--; + continue; } } - if (!destinationFile.exists()) + if ( !destinationFile.exists() ) { - throw new Exception("Failed to download " + baseUrl + file); + throw new Exception( "Failed to download " + baseUrl + file ); } } - catch (Exception e) + catch ( Exception e ) { - throw new BuildException(e); + throw new BuildException( e ); } } } @@ -493,26 +480,26 @@ * to <code>baseDir</code> * @param project the Ant project to create the reference in * @param reference the name of the reference to create - * @param list the list of jar files to append to the new classpath + * @param list the list of jar files to append to the new classpath * reference * @param baseDir the directory the specified jars are relative to */ - public static void createClasspathReference(Project project, - String reference, - List list, - File baseDir) + public static void createClasspathReference( Project project, + String reference, + List list, + File baseDir ) { - Path classpath = new Path(project); + Path classpath = new Path( project ); - for (Iterator i = list.iterator(); i.hasNext();) + for ( Iterator i = list.iterator(); i.hasNext(); ) { String jar = (String) i.next(); - Path p = new Path(project); - p.setPath(new File(baseDir, jar).getAbsolutePath()); - classpath.append(p); + Path p = new Path( project ); + p.setPath( new File( baseDir, jar ).getAbsolutePath() ); + classpath.append( p ); } - project.addReference(reference, classpath); + project.addReference( reference, classpath ); } /** @@ -524,49 +511,50 @@ * @param list the list of lines (Strings) specifying include=, exclude= or * a file name */ - public static void createPatternSetReference(Project project, - String reference, - List list) + public static void createPatternSetReference( Project project, + String reference, + List list ) { StringBuffer includesSb = new StringBuffer(); StringBuffer excludesSb = new StringBuffer(); PatternSet patternSet = new PatternSet(); - for (Iterator i = list.iterator(); i.hasNext();) + for ( Iterator i = list.iterator(); i.hasNext(); ) { String line = (String) i.next(); line = line.trim(); - includesSb.append(line).append(','); + includesSb.append( line ).append( ',' ); } String includes = includesSb.toString(); String excludes = excludesSb.toString(); - if (includes.length() > 0) + if ( includes.length() > 0 ) { // Remove trailing comma - includes = includes.substring(0, includes.length() - 1); - patternSet.setIncludes(includes); + includes = includes.substring( 0, includes.length() - 1 ); + patternSet.setIncludes( includes ); } - if (excludes.length() > 0) + if ( excludes.length() > 0 ) { // Remove trailing comma - excludes = includes.substring(0, includes.length() - 1); - patternSet.setExcludes(excludes); + excludes = includes.substring( 0, includes.length() - 1 ); + patternSet.setExcludes( excludes ); } - project.addReference(reference, patternSet); + project.addReference( reference, patternSet ); } - private boolean validProperty(String property) + private boolean validProperty( String property ) { - if (property != null && property.length() > 0 && !property.startsWith("${")) + if ( property != null && property.length() > 0 && !property.startsWith( "${" ) ) { return true; } - + return false; - } + } + /** * Returns the online. * @return String @@ -580,7 +568,7 @@ * Sets the online. * @param online The online to set */ - public void setOnline(String online) + public void setOnline( String online ) { this.online = online; } No revision No revision 1.3.2.1 +5 -0 maven/xdocs/misc/articles.xml Index: articles.xml =================================================================== RCS file: /home/cvs/maven/xdocs/misc/articles.xml,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- articles.xml 23 Oct 2003 19:07:43 -0000 1.3 +++ articles.xml 26 Nov 2003 09:59:47 -0000 1.3.2.1 @@ -44,6 +44,11 @@ Developing with Maven by Rob Herbst </a> </li> + <li> + <a href="http://www.jdocentral.com/JDO_Articles_20031117.html"> + JDO Meets Maven by Andy Jefferson + </a> + </li> </ul> </section> <section name="Articles"> No revision No revision 1.1.2.1 +0 -0 maven/xdocs/project/initial-proposal.txt Index: initial-proposal.txt =================================================================== RCS file: /home/cvs/maven/xdocs/project/initial-proposal.txt,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 1.1.2.1 +0 -0 maven/xdocs/project/maven-resolution.txt Index: maven-resolution.txt =================================================================== RCS file: /home/cvs/maven/xdocs/project/maven-resolution.txt,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]