dion 2002/06/10 03:24:40
Modified: . project.xml jars.list
Added: src/java/org/apache/maven Build.java
Log:
Start of java based build driver for Maven, based on IRC discussions.
The first cut of this driver will use the existing maven resources and
delegate to them with as little change as possible. Additional requirements
will be implemented as soon as possible, i.e. this is an incremental process
open for review and change at any point.
Updated project dependencies, and hence jars.list as well to include usage
of commons-cli.
Revision Changes Path
1.104 +6 -0 jakarta-turbine-maven/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- project.xml 6 Jun 2002 18:09:25 -0000 1.103
+++ project.xml 10 Jun 2002 10:24:40 -0000 1.104
@@ -383,6 +383,12 @@
<url>http://jakarta.apache.org/commons/</url>
</dependency>
+ <dependency>
+ <id>commons-cli</id>
+ <version>1.0-dev</version>
+ <url>http://jakarta.apache.org/commons/sandbox/cli/</url>
+ </dependency>
+
<!-- Documentation dependencies -->
<dependency>
1.17 +1 -0 jakarta-turbine-maven/jars.list
Index: jars.list
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/jars.list,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- jars.list 6 Jun 2002 18:19:04 -0000 1.16
+++ jars.list 10 Jun 2002 10:24:40 -0000 1.17
@@ -26,6 +26,7 @@
checkstyle-2.2.jar
commons-beanutils-1.4-dev.jar
commons-betwixt-1.0-dev.jar
+commons-cli-1.0-dev.jar
commons-collections-2.0.jar
commons-digester-1.2.jar
commons-graph-0.8.jar
1.1 jakarta-turbine-maven/src/java/org/apache/maven/Build.java
Index: Build.java
===================================================================
package org.apache.maven;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.MissingArgumentException;
import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.UnrecognizedOptionException;
/**
* The 'driver' for maven, in java form.
* This class looks after the following things:
* <ul>
* <li>Accepting command line args from the user</li>
* <li>Scanning installed plugins and determining if the task the
* user is requesting is available, and if so, how to execute it</li>
* <li>It is responsible for holding the 'properties' of maven and
* their overrides provided by the user</li>
* <li>Plugin management - downloading/installing plugins and their
* dependencies as required</li>
* <li>Providing access to the maven 'environment' for plugins/other tools
* </li>
* </ul>
*
* <p>The first cut of this driver will use the existing maven resources and
* delegate to them with as little change as possible. Additional requirements
* will be implemented as soon as possible, i.e. this is an incremental process
* open for review and change at any point.</p>
* <p>Current restrictions:</p>
* <ul>
* <li>plugins can only be written in ant</li>
* </ul>
*
* @author dion
* @version $Id: Build.java,v 1.1 2002/06/10 10:24:40 dion Exp $
*/
public class Build
{
/** the one character option for specifying the project */
private static final char PROJECT_OPTION = 'p';
/** the longer string version of the project option */
private static final String PROJECT_LONG_OPTION = "project";
/** */
private static final String DEFAULT_PROJECT_DESCRIPTOR = "project.xml";
/** the file name of the maven project descriptor */
private String projectDescriptorFileName;
/** Creates a new instance of Build */
public Build()
{
}
/**
* Create a new instance of the class, setting the properties from the
* arguments provided on the command line and execute the build process
*
* @param args the command line arguments
*/
public static void main(String[] args)
{
try
{
Build build = new Build();
// pass options from command line to build
build.configure(args);
// execute the build
build.run();
}
catch (Throwable problem)
{
problem.printStackTrace();
}
}
/** configure the build from the provided command line
* @param args command line arguments
* @throws MissingArgumentException if one of the options which is supposed
* to have an argument, doesn't.
*/
public void configure(String[] args) throws MissingArgumentException,
ParseException
{
try
{
CommandLine cmdLine = getOptions().parse(args);
if (cmdLine.hasOption(PROJECT_OPTION))
{
setProjectDescriptorFileName(cmdLine.getOptionValue(
Build.PROJECT_OPTION));
}
else
{
setProjectDescriptorFileName(Build.DEFAULT_PROJECT_DESCRIPTOR);
}
}
catch (MissingOptionException moe)
{
// no arguments are currently required, so ignoring
}
catch (UnrecognizedOptionException ure)
{
// no need to fail on extra options that are not supported
}
}
/**
* Run the build as currently configured
*/
public void run()
{
}
/**
* Provide a list of command line options supported
*/
public static Options getOptions()
{
Options options = new Options();
options.addOption(PROJECT_OPTION, PROJECT_LONG_OPTION, true,
"The maven project descriptor of the project to be built", false);
return options;
}
/** provide access to the file name of the project descriptor
* @return a string representing the file name of the maven project
* descriptor to be used for the build
*/
public String getProjectDescriptorFileName()
{
return projectDescriptorFileName;
}
/** Change the project descriptor file name.
* FIXME: Need comments here about when the change of this value makes
* no sense/has unintended effects
* @param projectDescriptorFileName new value as a String
*/
public void setProjectDescriptorFileName(String projectDescriptorFileName)
{
this.projectDescriptorFileName = projectDescriptorFileName;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>