You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bw...@apache.org on 2003/04/25 03:16:31 UTC
cvs commit: maven-new/src/test/org/apache/maven/plugins/suiterunner SuiteRunnerComponentTest.java
bwalding 2003/04/24 18:16:31
Modified: src/java/org/apache/maven/project Project.java
src/test/org/apache/maven DefaultMavenTest.xml
DefaultMavenTest.java
src/test/org/apache/maven/plugins/example
ExampleComponentTest.xml
src/java/org/apache/maven/plugin Plugin.java
PluginManager.java DefaultPluginManager.java
src/java/org/apache/maven/plugins/suiterunner
SuiteRunnerService.java SuiteRunnerComponent.java
src/java/org/apache/maven/cli CLI.java CLI.xml
src/java/org/apache/maven DefaultMaven.java
MavenReturnCodes.java
src/test/org/apache/maven/plugins/suiterunner
SuiteRunnerComponentTest.java
Added: src/java/org/apache/maven/plugin PluginGoalAction.java
JavaPlugin.java DefaultPluginCacheManager.java
PluginCacheManager.java PluginGoal.java
Removed: src/java/org/apache/maven/plugin PluginService.java
Log:
Goal execution "works" now. It is megahardwired, but the chain from Maven -> SuiteRunner.runTests functions.
Revision Changes Path
1.3 +2 -1 maven-new/src/java/org/apache/maven/project/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/project/Project.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Project.java 16 Apr 2003 12:39:28 -0000 1.2
+++ Project.java 25 Apr 2003 01:16:29 -0000 1.3
@@ -85,6 +85,7 @@
{
/** Project dependencies */
private List dependencies;
+ public static final String CONTEXT_KEY = Project.class.getName();
/** Repository where this project is stored. */
private Repository repository;
1.4 +17 -5 maven-new/src/test/org/apache/maven/DefaultMavenTest.xml
Index: DefaultMavenTest.xml
===================================================================
RCS file: /home/cvs/maven-new/src/test/org/apache/maven/DefaultMavenTest.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultMavenTest.xml 16 Apr 2003 23:44:56 -0000 1.3
+++ DefaultMavenTest.xml 25 Apr 2003 01:16:30 -0000 1.4
@@ -75,11 +75,23 @@
-->
<component>
- <role>org.apache.maven.plugin.PluginManager</role>
- <implementation>org.apache.maven.plugin.DefaultPluginManager</implementation>
- <configuration>
- </configuration>
- </component>
+ <role>org.apache.maven.plugin.PluginManager</role>
+ <implementation>org.apache.maven.plugin.DefaultPluginManager</implementation>
+ <configuration>
+ </configuration>
+ </component>
+
+ <!--
+ |
+ | Plugins (should be moved elsewhere at some point)
+ |
+ -->
+ <component>
+ <role>org.apache.maven.plugins.suiterunner.SuiteRunnerService</role>
+ <implementation>org.apache.maven.plugins.suiterunner.SuiteRunnerComponent</implementation>
+ <configuration>
+ </configuration>
+ </component>
</components>
1.2 +18 -8 maven-new/src/test/org/apache/maven/DefaultMavenTest.java
Index: DefaultMavenTest.java
===================================================================
RCS file: /home/cvs/maven-new/src/test/org/apache/maven/DefaultMavenTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultMavenTest.java 16 Apr 2003 15:16:56 -0000 1.1
+++ DefaultMavenTest.java 25 Apr 2003 01:16:30 -0000 1.2
@@ -56,20 +56,30 @@
* ----------------------------------------------------------------------------
*/
+import java.io.File;
+
import org.apache.plexus.PlexusTestCase;
-public class DefaultMavenTest
- extends PlexusTestCase
+public class DefaultMavenTest extends PlexusTestCase
{
- public DefaultMavenTest( String name )
+ public DefaultMavenTest(String name)
{
- super( name );
+ super(name);
}
- public void testComponent()
- throws Exception
+ public void testGetComponent() throws Exception
{
- Maven maven = (Maven) getComponent( Maven.ROLE );
- assertNotNull( maven );
+ Maven maven = (Maven) getComponent(Maven.ROLE);
+ assertNotNull(maven);
+ }
+
+ public void testComponent() throws Exception
+ {
+ Maven maven = (Maven) getComponent(Maven.ROLE);
+ assertNotNull(maven);
+ maven.setProjectFile(new File(System.getProperty("basedir") + "/src/test-input/project.xml"));
+
+ maven.addGoal("suiterunner:test");
+ maven.attainGoals();
}
}
1.2 +1 -1 maven-new/src/test/org/apache/maven/plugins/example/ExampleComponentTest.xml
Index: ExampleComponentTest.xml
===================================================================
RCS file: /home/cvs/maven-new/src/test/org/apache/maven/plugins/example/ExampleComponentTest.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExampleComponentTest.xml 21 Apr 2003 14:39:11 -0000 1.1
+++ ExampleComponentTest.xml 25 Apr 2003 01:16:30 -0000 1.2
@@ -41,7 +41,7 @@
<component>
<role>org.apache.maven.plugins.example.ExampleService</role>
<implementation>org.apache.maven.plugins.example.ExampleComponent</implementation>
- <instantiation>per-lookup</instantiation>
+ <instantiation>ass</instantiation>
<configuration>
<host>localhost</host>
<port>10000</port>
1.2 +6 -1 maven-new/src/java/org/apache/maven/plugin/Plugin.java
Index: Plugin.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugin/Plugin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Plugin.java 24 Apr 2003 23:33:52 -0000 1.1
+++ Plugin.java 25 Apr 2003 01:16:30 -0000 1.2
@@ -70,7 +70,12 @@
*/
public interface Plugin
{
+ /**
+ * @see org.apache.maven.plugin.Goal
+ * @return a List of Goal objects
+ */
public List getGoals();
public void runGoal(String goal, Context context) throws Exception;
+ public void runGoal(PluginGoal goal, Context context) throws Exception;
}
1.3 +4 -1 maven-new/src/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PluginManager.java 22 Apr 2003 13:03:02 -0000 1.2
+++ PluginManager.java 25 Apr 2003 01:16:30 -0000 1.3
@@ -2,11 +2,14 @@
import java.util.List;
+import org.apache.avalon.framework.context.Context;
+
public interface PluginManager
{
/** Role for the plugin manager. */
static final String ROLE = PluginManager.class.getName();
- PluginService getPlugin(String id);
+ void attainGoals(Context context, List goals);
+ Plugin getPlugin(String id);
List getPlugins();
}
1.3 +123 -6 maven-new/src/java/org/apache/maven/plugin/DefaultPluginManager.java
Index: DefaultPluginManager.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugin/DefaultPluginManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultPluginManager.java 22 Apr 2003 13:03:02 -0000 1.2
+++ DefaultPluginManager.java 25 Apr 2003 01:16:30 -0000 1.3
@@ -2,26 +2,40 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.maven.Maven;
import org.apache.maven.plugins.suiterunner.SuiteRunnerComponent;
+import org.apache.maven.project.Project;
+import org.apache.plexus.context.DefaultPlexusContext;
import org.apache.plexus.logging.AbstractLogEnabled;
+import org.apache.plexus.service.ServiceBroker;
+import org.apache.plexus.service.Serviceable;
-public class DefaultPluginManager
- extends AbstractLogEnabled
- implements PluginManager
+import com.werken.werkz.Action;
+import com.werken.werkz.CyclicGoalChainException;
+import com.werken.werkz.Goal;
+import com.werken.werkz.Session;
+import com.werken.werkz.WerkzProject;
+
+public class DefaultPluginManager extends AbstractLogEnabled implements PluginManager, Serviceable
{
+ private ServiceBroker serviceBroker;
/* (non-Javadoc)
* @see org.apache.maven.plugin.PluginManager#getPlugin(java.lang.String)
*/
- public PluginService getPlugin(String id)
+ public Plugin getPlugin(String id)
{
- if (id.equalsIgnoreCase("suiterunner")) {
+ if (id.equalsIgnoreCase("suiterunner"))
+ {
//XXX should be getting it from plexus somehow
return new SuiteRunnerComponent();
}
-
+
throw new RuntimeException("No plugin found : " + id);
}
@@ -34,5 +48,108 @@
List l = new ArrayList();
l.add(new SuiteRunnerComponent());
return Collections.unmodifiableList(l);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.plugin.PluginManager#attainGoals(org.apache.avalon.framework.context.Context)
+ */
+ public void attainGoals(Context context, List goals)
+ {
+ try
+ {
+ Project project = (Project) context.get(Project.CONTEXT_KEY);
+ goalExecutionContext.put(Project.CONTEXT_KEY, project);
+ Session session = new Session();
+ Iterator goalIter = goals.iterator();
+ while (goalIter.hasNext())
+ {
+ String goal = (String) goalIter.next();
+ werkzProject.attainGoal(goal,session);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new RuntimeException(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * XXX BRW Not really sure what this is supposed to do?
+ * @param context
+ * @throws Exception
+ */
+ public void run(Context context) throws Exception
+ {
+ Maven maven = (Maven) context.get("maven");
+ String goal = "harness";
+ System.out.println("Attaining root goal " + goal);
+ //Everything should be hooked against werkz objects and then we can just
+ //attain the whole lot from the werkz project.
+ }
+
+ /**
+ * @see org.apache.plexus.service.Serviceable#service(org.apache.plexus.service.ServiceBroker)
+ */
+ final DefaultPlexusContext goalExecutionContext = new DefaultPlexusContext();
+ final WerkzProject werkzProject = new WerkzProject();
+ public void service(ServiceBroker serviceBroker) throws ServiceException
+ {
+ this.serviceBroker = serviceBroker;
+
+ //For each plugin
+ Iterator pluginIter = getPlugins().iterator();
+ while (pluginIter.hasNext())
+ {
+ final Plugin plugin = (Plugin) pluginIter.next();
+ Iterator goalIter = plugin.getGoals().iterator();
+ while (goalIter.hasNext())
+ {
+ final PluginGoal pluginGoal = (PluginGoal) goalIter.next();
+ Goal g = werkzProject.getGoal(pluginGoal.getName());
+ if (g == null)
+ {
+ g = new Goal(pluginGoal.getName());
+ }
+
+ g.setAction(new Action()
+ {
+ public boolean requiresAction()
+ {
+ return true;
+ }
+
+ public void performAction() throws Exception
+ {
+ plugin.runGoal(pluginGoal, goalExecutionContext);
+ }
+ });
+ werkzProject.addGoal(g);
+
+ Iterator prerequisiteNameIter = pluginGoal.getPrerequisiteNames().iterator();
+ while (prerequisiteNameIter.hasNext())
+ {
+ String prerequisiteName = (String) prerequisiteNameIter.next();
+ Goal prg = werkzProject.getGoal(prerequisiteName);
+ if (prg == null)
+ {
+ prg = new Goal(prerequisiteName);
+ }
+
+ try
+ {
+ g.addPrecursor(prg);
+ }
+ catch (CyclicGoalChainException e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+ }
+ //Need to perform a pre-requisite stage here also.
+
}
}
1.1 maven-new/src/java/org/apache/maven/plugin/PluginGoalAction.java
Index: PluginGoalAction.java
===================================================================
package org.apache.maven.plugin;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 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 apache@apache.org.
*
* 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/>.
*
* ====================================================================
*/
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id: PluginGoalAction.java,v 1.1 2003/04/25 01:16:30 bwalding Exp $
*/
public interface PluginGoalAction
{
public void attain() throws Exception;
}
1.1 maven-new/src/java/org/apache/maven/plugin/JavaPlugin.java
Index: JavaPlugin.java
===================================================================
/*
* Created on 25/04/2003
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package org.apache.maven.plugin;
import java.util.List;
import org.apache.avalon.framework.context.Context;
/**
*
* This class doesn't make any sense to me. And I wrote it!
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id: JavaPlugin.java,v 1.1 2003/04/25 01:16:30 bwalding Exp $
*/
public class JavaPlugin implements Plugin
{
/* (non-Javadoc)
* @see org.apache.maven.plugin.Plugin#getGoals()
*/
public List getGoals()
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.apache.maven.plugin.Plugin#runGoal(java.lang.String, org.apache.avalon.framework.context.Context)
*/
public void runGoal(String goal, Context context) throws Exception
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.apache.maven.plugin.Plugin#runGoal(org.apache.maven.plugin.Goal, org.apache.avalon.framework.context.Context)
*/
public void runGoal(PluginGoal goal, Context context) throws Exception
{
// TODO Auto-generated method stub
}
}
1.1 maven-new/src/java/org/apache/maven/plugin/DefaultPluginCacheManager.java
Index: DefaultPluginCacheManager.java
===================================================================
package org.apache.maven.plugin;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 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 apache@apache.org.
*
* 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 com.werken.werkz.CyclicGoalChainException;
import com.werken.werkz.Goal;
import com.werken.werkz.NoSuchGoalException;
import com.werken.werkz.WerkzProject;
import org.apache.commons.lang.StringUtils;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;
/**
* This is the process that we use:
*
* - Start with goal X.
* - Gather prereqs for X.
*
* We want to find all goals that will be executed due to X being executed
* we don't care about ordering here because when werkz executes it will sort
* that out for us. We just need to make sure all the appropriate plugins have
* been loaded so that werkz can find the goals it needs.
*
* For a single goal we will collect the set of goals that will be executed with
* it.
*
*/
public class DefaultPluginCacheManager
extends DefaultHandler
{
/** Goals with a pointer to plugins with callbacks. */
private HashMap callbackPeersMap = new HashMap();
/** dyna tag -> plugin map. Where dyna tags live. */
private HashMap dynaTagPluginMap = new HashMap();
/** A plugins dyna tag dependencies. */
private HashMap pluginDynaTagDepsMap = new HashMap();
/** Goal -> plugin map. */
private HashMap goalPluginMap = new HashMap();
/** Currently executing plugin script. */
private File pluginScript;
/** Parent directory of the currently executing plugin script. */
private String pluginScriptDirectory;
private boolean insideGoal;
private Goal currentGoal;
private boolean insideCallback;
private String currentCallbackGoalName;
private WerkzProject goalProject = new WerkzProject();
/** Default constructor. */
public DefaultPluginCacheManager()
{
}
// ----------------------------------------------------------------------
// A C C E S S O R S
// ----------------------------------------------------------------------
/**
*
* @param pluginScript
*/
public void setPluginScript( File pluginScript )
{
this.pluginScript = pluginScript;
pluginScriptDirectory = pluginScript.getParentFile().getName();
}
/**
*
* @return
*/
public File getPluginScript()
{
return pluginScript;
}
private File pluginsDir;
/**
* Set the pluginsDir attribute.
*
* @param pluginsDir
*/
public void setPluginsDir( File pluginsDir )
{
this.pluginsDir = pluginsDir;
}
/**
* Get the pluginsDir attribute.
*
* @return The
*/
public File getPluginsDir()
{
return pluginsDir;
}
// ----------------------------------------------------------------------
// I M P L E M E N T A T I O N
// ----------------------------------------------------------------------
/**
*/
public void parse()
{
try
{
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware( true );
SAXParser parser = saxFactory.newSAXParser();
InputSource is = new InputSource( new FileInputStream( getPluginScript() ) );
parser.parse( is, this );
}
catch ( Exception e )
{
e.printStackTrace();
}
}
public void saveCache()
throws Exception
{
}
/**
* Load on-disk cache information, if possible.
*/
void loadCache()
{
}
private HashSet getPluginDynaTagDeps( String pluginName )
{
HashSet pluginDynaTagDeps = (HashSet) pluginDynaTagDepsMap.get( pluginName );
if ( pluginDynaTagDeps == null )
{
pluginDynaTagDeps = new HashSet();
pluginDynaTagDepsMap.put( pluginName, pluginDynaTagDeps );
}
return pluginDynaTagDeps;
}
private HashSet getCallbackPeers( String goalName )
{
HashSet callbackPeers = (HashSet) callbackPeersMap.get( goalName );
if ( callbackPeers == null )
{
callbackPeers = new HashSet();
callbackPeersMap.put( goalName, callbackPeers );
}
return callbackPeers;
}
/**
* We are looking for namespace declarations like the following:
*
* xmlns:doc="doc"
*
* Here we know that the given plugin.jelly script (or any jelly script used
* within Maven) has a dependency on the dyna tag lib named 'doc'. We need to
* make sure that this dyna tag lib is ready for use when the plugin.jelly
* script is run.
*
* @param prefix Prefix to be used in the jelly script.
* @param uri Uri of the dyna tag lib.
*/
public void startPrefixMapping( String prefix, String uri )
{
if ( uri.startsWith( "jelly:" ) == false
&& uri.startsWith( "dummy" ) == false
&& uri.equals( "" ) == false )
{
getPluginDynaTagDeps( pluginScriptDirectory ).add( uri );
}
}
/**
* Handles opening elements of the xml file.
*/
public void startElement( String uri, String localName, String rawName, Attributes attributes )
{
if ( rawName.equals( "goal" ) )
{
String name = StringUtils.deleteWhitespace( attributes.getValue( "name" ) );
Goal goal = goalProject.getGoal( name, true );
goalProject.addGoal( goal );
// Add to the goal -> plugin map. */
goalPluginMap.put( name, pluginScriptDirectory );
// Set the current goal.
insideGoal = true;
String prereqs = attributes.getValue( "prereqs" );
//String description = attributes.getValue( "description" );
if ( prereqs != null )
{
String[] s = StringUtils.split( prereqs, "," );
for ( int i = 0; i < s.length; i++ )
{
try
{
Goal prereq = goalProject.getGoal( s[i], true );
goal.addPrecursor( prereq );
}
catch ( CyclicGoalChainException e )
{
// do nothing.
}
}
}
currentGoal = goal;
}
else if ( rawName.equals( "preGoal" ) )
{
String name = attributes.getValue( "name" );
getCallbackPeers( name ).add( pluginScriptDirectory );
insideCallback = true;
currentCallbackGoalName = name;
}
else if ( rawName.equals( "postGoal" ) )
{
String name = attributes.getValue( "name" );
getCallbackPeers( name ).add( pluginScriptDirectory );
insideCallback = true;
currentCallbackGoalName = name;
}
else if ( rawName.equals( "attainGoal" ) )
{
String name = attributes.getValue( "name" );
if ( insideGoal )
{
try
{
currentGoal.addPrecursor( goalProject.getGoal( name, true ) );
}
catch ( CyclicGoalChainException e )
{
// do nothing.
}
}
else if ( insideCallback )
{
try
{
Goal g = goalProject.getGoal( currentCallbackGoalName );
g.addPrecursor( goalProject.getGoal( name, true ) );
}
catch ( CyclicGoalChainException e )
{
// do nothing.
}
}
}
else if ( localName.equals( "taglib" )
&& uri.equals( "jelly:define" ) )
{
String tagLibUri = attributes.getValue( "uri" );
dynaTagPluginMap.put( tagLibUri, pluginScriptDirectory );
}
}
public void endElement( String uri, String localName, String rawName )
{
if ( rawName.equals( "goal" ) )
{
insideGoal = false;
}
else if ( rawName.equals( "preGoal" ) )
{
insideCallback = false;
}
else if ( rawName.equals( "postGoal" ) )
{
insideCallback = false;
}
}
/**
*
* @param goal
*/
Set resolvePlugins( String goal )
throws NoSuchGoalException
{
HashSet plugins = new HashSet();
Goal[] chain = goalProject.getExecutionChain( goal );
for ( int i = 0; i < chain.length; i++ )
{
Goal g = chain[i];
String plugin = (String) goalPluginMap.get( g.getName() );
plugins.add( plugin );
plugins.addAll( getCallbackPeers( goal ) );
}
Set a = resolveDynaTagPlugins( plugins );
plugins.addAll( a );
return plugins;
}
private Set resolveDynaTagPlugins( Set plugins )
{
Set resolvedDynaTagPlugins = new HashSet();
for ( Iterator i = plugins.iterator(); i.hasNext(); )
{
String plugin = (String) i.next();
Set dynaTagDeps = getPluginDynaTagDeps( plugin );
for ( Iterator j = dynaTagDeps.iterator(); j.hasNext(); )
{
LinkedList dynaTagUris = new LinkedList();
Set seen = new HashSet();
dynaTagUris.add( j.next() );
while ( dynaTagUris.isEmpty() == false )
{
String dynaTagUri = (String) dynaTagUris.removeFirst();
if ( seen.contains( dynaTagUri ) )
{
continue;
}
seen.add( dynaTagUri );
String dynaTagPluginHome = (String) dynaTagPluginMap.get( dynaTagUri );
dynaTagUris.addAll( getPluginDynaTagDeps( dynaTagPluginHome ) );
resolvedDynaTagPlugins.add( dynaTagPluginHome );
}
}
}
return resolvedDynaTagPlugins;
}
/**
* Warning callback.
*
* @param spe The parse exception that caused the callback to be invoked.
*/
public void warning( SAXParseException spe )
{
printParseError( "Warning", spe );
}
/**
* Error callback.
*
* @param spe The parse exception that caused the callback to be invoked.
*/
public void error( SAXParseException spe )
{
printParseError( "Error", spe );
}
/**
* Fatal error callback.
*
* @param spe The parse exception that caused the callback to be invoked.
*/
public void fatalError( SAXParseException spe )
{
printParseError( "Fatal Error", spe );
}
/**
* Description of the Method
*/
private final void printParseError( String type, SAXParseException spe )
{
System.err.println( type + " [line " + spe.getLineNumber() +
", row " + spe.getColumnNumber() + "]: " +
spe.getMessage() );
}
}
1.1 maven-new/src/java/org/apache/maven/plugin/PluginCacheManager.java
Index: PluginCacheManager.java
===================================================================
package org.apache.maven.plugin;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 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 apache@apache.org.
*
* 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 java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.FileOutputStream;
import java.util.Set;
import java.util.HashSet;
import java.util.Properties;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.lang.StringUtils;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/**
*/
public class PluginCacheManager
extends DefaultHandler
{
/** Plug-in cache */
public static final String PLUGINS_CACHE = "plugins.cache";
/** Goal cache */
public static final String GOALS_CACHE = "goals.cache";
public static final String CALLBACKS_CACHE = "callbacks.cache";
/** Taglibs cache */
public static final String DYNAMIC_TAGLIBS_CACHE = "dynatag.cache";
/** Plugin -> dynatag dependencies. */
public static final String PLUGIN_DYNATAG_DEPS_CACHE = "plugin-dynatag-deps.cache";
/** Currently executing plugin script. */
private File pluginScript;
/** Parent directory of the currently executing plugin script. */
private String pluginScriptDirectory;
/** Currently executing plugin name. */
private String pluginName;
/**
* The goals caches contains a mapping of goal names to a description for the
* goal and any prerequisite goals.
*/
private Properties goalCache = new Properties();
/**
* The plugin cache contains a mapping of plugin name to the actual directory
* name where the plugin is stored in maven's plugin directory.
*/
private Properties pluginCache = new Properties();
/**
* Dyanamic tag libraries that are created within plugin.jelly scripts using
* the jelly:define tags. So we might have something like the following:
*
* <define:taglib uri="aptdoc">
* <define:jellybean
* name="convert"
* className="org.apache.maven.aptdoc.AptToXdocConverter"
* method="doExecute"
* />
* </define:taglib>
*
* What will end up in the dynamic-taglibs.cache file is something like
* the following:
*
* aptdoc=maven-aptdoc-1.0-SNAPSHOT
*/
private Properties dynaTagLibCache = new Properties();
/**
* This is list of registered preGoals and postGoals in the various plugins. For
* example the antlr plugin has preGoal set on java:compile goal to make sure that
* that antlr can generate the requested sources before java:compile executes. In
* this case we have something like the following registered in the callbacks.cache
* file:
*
* java\:compile.pre=maven-antlr-plugin-1.1-SNAPSHOT
*
* Note that ":" is a key termination character to the Properties class so we
* escape it to be identified as a ":" character.
*/
private Properties callbackCache = new Properties();
/**
* Plugin dependencies on dyna tags. So, for example, the junit plugin
* depends on the 'doc' dynatag which provides the mechanism to perform
* a JSL transformation.
*/
private Properties pluginDynaTagDepsCache = new Properties();
/** Goals that have been encountered while processing a plugin. */
private Set pluginGoals = new HashSet();
/** Dyna tag lib declarations encountered in a plugin. */
private Set dynaTagLibDecls = new HashSet();
/**
* Flag that tells the cache manager to clear plugin goals and dyna tag
* lib decls when the plugin script is changed.
*/
private boolean clear = true;
/** Default constructor. */
public PluginCacheManager()
{
}
/**
*
* @param clear
*/
public PluginCacheManager( boolean clear )
{
this.clear = clear;
}
// ----------------------------------------------------------------------
// A C C E S S O R S
// ----------------------------------------------------------------------
/**
*
* @param goalCache
*/
public void setGoalCache( Properties goalCache )
{
this.goalCache = goalCache;
}
/**
*
* @return
*/
public Properties getGoalCache()
{
return goalCache;
}
/**
*
* @param pluginCache
*/
public void setPluginCache( Properties pluginCache )
{
this.pluginCache = pluginCache;
}
/**
*
* @return
*/
public Properties getPluginCache()
{
return pluginCache;
}
/**
*
* @param dynamicTagLibCache
*/
public void setDynaTagLibCache( Properties dynamicTagLibCache )
{
this.dynaTagLibCache = dynamicTagLibCache;
}
/**
*
* @return
*/
public Properties getDynaTagLibCache()
{
return dynaTagLibCache;
}
/**
*
* @param callbackCache
*/
public void setCallbackCache( Properties callbackCache )
{
this.callbackCache = callbackCache;
}
/**
*
* @return
*/
public Properties getCallbackCache()
{
return callbackCache;
}
/**
*
* @param pluginScript
*/
public void setPluginScript( File pluginScript )
{
this.pluginScript = pluginScript;
pluginScriptDirectory = pluginScript.getParentFile().getName();
pluginName = pluginScriptDirectory;
if ( clear )
{
// When we set a new plugin script to parse clear all our cached
// values and start anew.
pluginGoals.clear();
dynaTagLibDecls.clear();
}
}
/**
*
* @return
*/
public File getPluginScript()
{
return pluginScript;
}
private File pluginsDir;
/**
* Set the pluginsDir attribute.
*
* @param pluginsDir
*/
public void setPluginsDir( File pluginsDir )
{
this.pluginsDir = pluginsDir;
}
/**
* Get the pluginsDir attribute.
*
* @return The
*/
public File getPluginsDir()
{
return pluginsDir;
}
/**
* Set the pluginDynaTagDepsCache attribute.
*
* @param pluginDynaTagDepsCache
*/
public void setPluginDynaTagDepsCache( Properties pluginDynaTagDepsCache )
{
this.pluginDynaTagDepsCache = pluginDynaTagDepsCache;
}
/**
* Get the pluginDynaTagDepsCache attribute.
*
* @return The
*/
public Properties getPluginDynaTagDepsCache()
{
return pluginDynaTagDepsCache;
}
public Set getDynaTagLibDecls()
{
return dynaTagLibDecls;
}
// ----------------------------------------------------------------------
// I M P L E M E N T A T I O N
// ----------------------------------------------------------------------
/**
*/
public void parse()
{
try
{
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware( true );
SAXParser parser = saxFactory.newSAXParser();
InputSource is = new InputSource( new FileInputStream( getPluginScript() ) );
parser.parse( is, this );
}
catch ( Exception e )
{
e.printStackTrace();
}
}
public void saveCache()
throws Exception
{
getPluginCache().store(
new FileOutputStream( new File( getPluginsDir(), PLUGINS_CACHE ) ), "plugins cache" );
getGoalCache().store(
new FileOutputStream( new File( getPluginsDir(), GOALS_CACHE ) ), "goals cache" );
getCallbackCache().store(
new FileOutputStream( new File( getPluginsDir(), CALLBACKS_CACHE ) ), "callbacks cache" );
getDynaTagLibCache().store(
new FileOutputStream( new File( getPluginsDir(), DYNAMIC_TAGLIBS_CACHE ) ), "taglibs cache" );
getPluginDynaTagDepsCache().store(
new FileOutputStream( new File( getPluginsDir(), PLUGIN_DYNATAG_DEPS_CACHE ) ), "plugin deps cache" );
}
/**
* Load on-disk cache information, if possible.
*/
void loadCache()
{
pluginCache = new Properties();
try
{
pluginCache.load( new FileInputStream( new File( getPluginsDir(), PLUGINS_CACHE ) ) );
}
catch ( IOException e )
{
// ignore, new cache.
}
goalCache = new Properties();
try
{
goalCache.load( new FileInputStream( new File( getPluginsDir(), GOALS_CACHE ) ) );
}
catch ( IOException e )
{
// ignore, new cache.
}
callbackCache = new Properties();
try
{
callbackCache.load( new FileInputStream( new File( getPluginsDir(), CALLBACKS_CACHE ) ) );
}
catch ( IOException e )
{
// ignore, new cache;
}
dynaTagLibCache = new Properties();
try
{
dynaTagLibCache.load( new FileInputStream( new File( getPluginsDir(), DYNAMIC_TAGLIBS_CACHE ) ) );
}
catch ( IOException e )
{
// ignore, new cache;
}
pluginDynaTagDepsCache = new Properties();
try
{
pluginDynaTagDepsCache.load( new FileInputStream( new File( getPluginsDir(), PLUGIN_DYNATAG_DEPS_CACHE ) ) );
}
catch ( IOException e )
{
// ignore, new cache;
}
}
/**
* We are looking for namespace declarations like the following:
*
* xmlns:doc="doc"
*
* Here we know that the given plugin.jelly script (or any jelly script used
* within Maven) has a dependency on the dyna tag lib named 'doc'. We need to
* make sure that this dyna tag lib is ready for use when the plugin.jelly
* script is run.
*
* @param prefix Prefix to be used in the jelly script.
* @param uri Uri of the dyna tag lib.
*/
public void startPrefixMapping( String prefix, String uri )
{
if ( uri.startsWith( "jelly:" ) == false
&& uri.startsWith( "dummy" ) == false
&& uri.equals( "" ) == false )
{
dynaTagLibDecls.add( uri );
String p = pluginDynaTagDepsCache.getProperty( pluginName );
if ( p != null )
{
// Prevent duplicate uri entries from being added.
if ( p.indexOf( uri ) >= 0 )
{
return;
}
p += "," + uri;
}
else
{
p = uri;
}
pluginDynaTagDepsCache.setProperty( pluginName, p );
}
}
/**
* Handles opening elements of the xml file.
*/
public void startElement( String uri, String localName, String rawName, Attributes attributes )
{
if ( rawName.equals( "goal" ) )
{
String name = StringUtils.deleteWhitespace( attributes.getValue( "name" ) );
String prereqs = attributes.getValue( "prereqs" );
String description = attributes.getValue( "description" );
String goalProperty = description + ">";
if ( prereqs != null )
{
goalProperty += StringUtils.deleteWhitespace( prereqs );
}
goalCache.setProperty( name, goalProperty );
pluginCache.setProperty( name, pluginScriptDirectory );
pluginGoals.add( name );
}
else if ( rawName.equals( "preGoal" ) )
{
String name = attributes.getValue( "name" );
String key = name + ".pre";
callbackCache.setProperty( key,
getCsvProperty( callbackCache,
key,
pluginScriptDirectory ) );
}
else if ( rawName.equals( "postGoal" ) )
{
String name = attributes.getValue( "name" );
String key = name + ".post";
callbackCache.setProperty( key,
getCsvProperty( callbackCache,
key,
pluginScriptDirectory ) );
}
/*
else if( rawName.equals( "attainGoal" ) )
{
String name = attributes.getValue( "name" );
// We're not using werkz here itself but we need to avoid circular
// dependencies when a plugin tries to attain goals that are within
// the plugin itself. We are assuming that the stated goal to attain
// has already been encountered. Not perfect but I don't think we
// should run into any trouble.
if ( pluginGoals.contains( name ) == false )
{
callbackCache.setProperty( name + ".pre", pluginScriptDirectory );
}
}
*/
// I still have a case that's falling through which is the changelog plugin
// and it's dependency on the doc plugin. I need to selectively remove
// an individual entry in the CSV list and not the whole thing.
else if ( localName.equals( "taglib" )
&& uri.equals( "jelly:define" ) )
{
String tagLibUri = attributes.getValue( "uri" );
dynaTagLibCache.setProperty( tagLibUri, pluginScriptDirectory );
// We don't need to set a dependency if the dyna tag lib is in
// the same jelly script where it's used.
if ( dynaTagLibDecls.contains( tagLibUri ) )
{
String prop = (String) pluginDynaTagDepsCache.get( pluginName );
int tl = tagLibUri.length();
// If there is only one dependency then just remove the whole entry.
if ( prop.indexOf( "," ) < 0 )
{
pluginDynaTagDepsCache.remove( pluginName );
}
else
{
int i = prop.indexOf( tagLibUri + "," );
if ( i == 0 )
{
// First
prop = prop.substring( tl + 1 );
}
else if ( i > 0 )
{
// Middle
prop = prop.substring( 0, i ) + prop.substring( i + tl + 1 );
}
else
{
// The last entry
prop = prop.substring( 0, prop.length() - tl - 1 );
}
pluginDynaTagDepsCache.put( pluginName, prop );
}
}
}
}
/**
* Manipulate a csv property string.
*
* @param properties
* @param key
* @param newEntry
* @return
*/
private String getCsvProperty( Properties properties,
String key,
String newEntry )
{
String csvProperty = properties.getProperty( key );
if ( csvProperty == null )
{
return newEntry;
}
else if ( csvProperty.indexOf( newEntry ) < 0 )
{
csvProperty += "," + newEntry;
}
return csvProperty;
}
/**
* Warning callback.
*
* @param spe The parse exception that caused the callback to be invoked.
*/
public void warning( SAXParseException spe )
{
printParseError( "Warning", spe );
}
/**
* Error callback.
*
* @param spe The parse exception that caused the callback to be invoked.
*/
public void error( SAXParseException spe )
{
printParseError( "Error", spe );
}
/**
* Fatal error callback.
*
* @param spe The parse exception that caused the callback to be invoked.
*/
public void fatalError( SAXParseException spe )
{
printParseError( "Fatal Error", spe );
}
/**
* Description of the Method
*/
private final void printParseError( String type, SAXParseException spe )
{
System.err.println( type + " [line " + spe.getLineNumber() +
", row " + spe.getColumnNumber() + "]: " +
spe.getMessage() );
}
}
1.1 maven-new/src/java/org/apache/maven/plugin/PluginGoal.java
Index: PluginGoal.java
===================================================================
package org.apache.maven.plugin;
import java.util.List;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 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 apache@apache.org.
*
* 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/>.
*
* ====================================================================
*/
/**
* This is description of a Goal, not the Goal itself.
*
* This is due to us not wanting code that gets hold of a Goal actually
* attaining it outside of the plugin.
*
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id: PluginGoal.java,v 1.1 2003/04/25 01:16:30 bwalding Exp $
*/
public class PluginGoal
{
private final String name;
private String description;
private List prerequisiteNames;
public PluginGoal(String name, List prerequisiteNames) {
this.name = name;
this.prerequisiteNames = prerequisiteNames;
}
public String getName() {
return name;
}
/**
* @return
*/
public String getDescription()
{
return description;
}
/**
* @param string
*/
public void setDescription(String string)
{
description = string;
}
/**
* @return
*/
public List getPrerequisiteNames()
{
return prerequisiteNames;
}
}
1.4 +3 -3 maven-new/src/java/org/apache/maven/plugins/suiterunner/SuiteRunnerService.java
Index: SuiteRunnerService.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugins/suiterunner/SuiteRunnerService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SuiteRunnerService.java 22 Apr 2003 13:10:05 -0000 1.3
+++ SuiteRunnerService.java 25 Apr 2003 01:16:30 -0000 1.4
@@ -7,13 +7,13 @@
package org.apache.maven.plugins.suiterunner;
import org.apache.avalon.framework.context.Context;
-import org.apache.maven.plugin.PluginService;
+import org.apache.maven.plugin.Plugin;
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id$
*/
-public interface SuiteRunnerService extends PluginService
+public interface SuiteRunnerService extends Plugin
{
public static final String ROLE = SuiteRunnerService.class.getName();
1.3 +45 -13 maven-new/src/java/org/apache/maven/plugins/suiterunner/SuiteRunnerComponent.java
Index: SuiteRunnerComponent.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/plugins/suiterunner/SuiteRunnerComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SuiteRunnerComponent.java 22 Apr 2003 13:03:15 -0000 1.2
+++ SuiteRunnerComponent.java 25 Apr 2003 01:16:30 -0000 1.3
@@ -21,6 +21,7 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
+import org.apache.maven.plugin.PluginGoal;
import org.apache.maven.project.Project;
import org.apache.plexus.logging.AbstractLogEnabled;
@@ -99,6 +100,18 @@
{
System.out.println("SuiteRunner.initialize()");
initialize = true;
+
+ {
+ List goals = new ArrayList();
+ PluginGoal g;
+
+ g = new PluginGoal("suiterunner:test", new ArrayList());
+ g.setDescription("does some testing with suiterunner");
+ goals.add(g);
+
+ this.goals = Collections.unmodifiableList(goals);
+ }
+
}
public void start() throws Exception
@@ -113,27 +126,38 @@
stop = true;
}
-
-
/* (non-Javadoc)
* @see org.apache.maven.plugins.suiterunner.SuiteRunnerService#runTests(java.lang.String, org.apache.maven.project.Project)
*/
public void runTests(Context context) throws ContextException
{
//Use the POM etc to locate and run the tests
- Project project = (Project) context.get("project");
+ Project project = (Project) context.get(Project.CONTEXT_KEY);
System.out.println("Running tests for project(id = " + project.getId() + ")");
-
+
}
- /* (non-Javadoc)
+ /**
* @see org.apache.maven.plugin.PluginService#getGoals()
*/
- public List getGoals()
+ private List goals;
+ public synchronized List getGoals()
{
- List l = new ArrayList();
- l.add("suiterunner:test");
- return Collections.unmodifiableList(l);
+ if (goals == null) {
+ //Why the hell wasn't that run as part of the lifecycle?
+ System.out.println("Initialize wasn't run as part of ocmponent lifecycle");
+ try
+ {
+ initialize();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException(e.getLocalizedMessage());
+
+ }
+ }
+ return this.goals;
}
/* (non-Javadoc)
@@ -141,11 +165,19 @@
*/
public void runGoal(String goal, Context context) throws ContextException
{
- if ("suiterunner:test".equals(goal)) {
+ if ("suiterunner:test".equals(goal))
+ {
runTests(context);
}
-
+
+ }
+
+ /** XXX Cull this?
+ * @see org.apache.maven.plugin.Plugin#runGoal(org.apache.maven.plugin.Goal, org.apache.avalon.framework.context.Context)
+ */
+ public void runGoal(PluginGoal goal, Context context) throws Exception
+ {
+ runGoal(goal.getName(), context);
}
-
}
1.2 +30 -45 maven-new/src/java/org/apache/maven/cli/CLI.java
Index: CLI.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/cli/CLI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CLI.java 22 Apr 2003 13:02:41 -0000 1.1
+++ CLI.java 25 Apr 2003 01:16:30 -0000 1.2
@@ -1,17 +1,5 @@
package org.apache.maven.cli;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-
-import org.apache.maven.plugin.PluginManager;
-import org.apache.maven.plugin.PluginService;
-import org.apache.maven.project.Project;
-import org.apache.maven.project.builder.ProjectUnmarshaller;
-import org.apache.plexus.DefaultPlexusContainer;
-import org.apache.plexus.context.DefaultPlexusContext;
-
/* ====================================================================
* The Apache Software License, Version 1.1
*
@@ -68,6 +56,11 @@
* ====================================================================
*/
+import java.io.File;
+
+import org.apache.maven.Maven;
+import org.apache.plexus.DefaultPlexusContainer;
+
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
* @version $Id$
@@ -97,46 +90,38 @@
container.setConfigurationResource(getClass().getResourceAsStream("CLI.xml"));
container.initialize();
}
+ /*
+ public void run(String args[]) throws Exception
+ {
+
+
+ XmlRpcClient xmlrpc = new XmlRpcClient("http://localhost:8765/maven/xmlrpc");
+ Vector params = new Vector();
+ params.addElement("some parameter");
+ // this method returns a string
+ String result = (String) xmlrpc.execute("method.name", params);
+ }
+ */
- public void run(String args[]) throws Exception
+ public void run(String args[])
+
{
+
+ try {
+
container.start();
String goal = args[0];
- PluginManager pluginManager = (PluginManager) container.getServiceRepository().lookup(PluginManager.ROLE);
- Iterator iter = pluginManager.getPlugins().iterator();
- PluginService ps = null;
- while (iter.hasNext())
- {
- PluginService pluginService = (PluginService) iter.next();
- if (pluginService.getGoals().contains(goal))
- {
- ps = pluginService;
-
- }
- }
-
- if (ps != null)
- {
- DefaultPlexusContext context = new DefaultPlexusContext();
- ProjectUnmarshaller pu =
- (ProjectUnmarshaller) container.getServiceRepository().lookup(ProjectUnmarshaller.ROLE);
-
- InputStream is = new FileInputStream("project.xml");
-
- Project testProject = pu.parse(new InputStreamReader(is));
- is.close();
- context.put("project", testProject);
- ps.runGoal(goal, context);
- }
- else
- {
+ Maven maven = (Maven) container.getServiceRepository().lookup(Maven.ROLE);
+ maven.setProjectFile(new File("project.xml"));
+ maven.addGoal(goal);
+ maven.attainGoals();
- System.err.println("Unable to find goal : " + goal);
- System.exit(-1);
+ } catch (Exception e) {
+ e.printStackTrace();
}
-
container.dispose();
+
}
1.2 +59 -15 maven-new/src/java/org/apache/maven/cli/CLI.xml
Index: CLI.xml
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/cli/CLI.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CLI.xml 22 Apr 2003 13:02:43 -0000 1.1
+++ CLI.xml 25 Apr 2003 01:16:30 -0000 1.2
@@ -30,35 +30,79 @@
-->
<components>
+ <!--
+ |
+ | Maven component.
+ |
+ -->
+ <component>
+ <role>org.apache.maven.Maven</role>
+ <implementation>org.apache.maven.DefaultMaven</implementation>
+ <configuration>
+ </configuration>
+ </component>
<!--
|
- | A Service
- |
- | This service implements all the Avalon lifecycle methods.
+ | ProjectBuilder component.
|
-->
<component>
- <role>org.apache.maven.plugin.PluginManager</role>
- <implementation>org.apache.maven.plugin.DefaultPluginManager</implementation>
- <instantiation>per-lookup</instantiation>
+ <role>org.apache.maven.project.builder.ProjectBuilder</role>
+ <implementation>org.apache.maven.project.builder.DefaultProjectBuilder</implementation>
<configuration>
- <host>localhost</host>
- <port>10000</port>
</configuration>
</component>
-
- <component>
+
+ <!--
+ |
+ | ProjectUnmarshaller component.
+ |
+ -->
+ <component>
<role>org.apache.maven.project.builder.ProjectUnmarshaller</role>
<implementation>org.apache.maven.project.builder.DefaultProjectUnmarshaller</implementation>
- <instantiation>per-lookup</instantiation>
<configuration>
- <host>localhost</host>
- <port>10000</port>
</configuration>
</component>
-
-
+
+ <!--
+ |
+ | DependencyVerifier component.
+ |
+ -->
+ <component>
+ <role>org.apache.maven.verifier.DependencyVerifier</role>
+ <implementation>org.apache.maven.verifier.DefaultDependencyVerifier</implementation>
+ <configuration>
+ </configuration>
+ </component>
+
+ <!--
+ |
+ | LocalSettingsVerifier component.
+ |
+ -->
+ <component>
+ <role>org.apache.maven.verifier.LocalSettingsVerifier</role>
+ <implementation>org.apache.maven.verifier.DefaultLocalSettingsVerifier</implementation>
+ <configuration>
+ </configuration>
+ </component>
+
+ <!--
+ |
+ | PluginManager component.
+ |
+ -->
+
+ <component>
+ <role>org.apache.maven.plugin.PluginManager</role>
+ <implementation>org.apache.maven.plugin.DefaultPluginManager</implementation>
+ <configuration>
+ </configuration>
+ </component>
+
</components>
1.7 +144 -126 maven-new/src/java/org/apache/maven/DefaultMaven.java
Index: DefaultMaven.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/DefaultMaven.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultMaven.java 22 Apr 2003 00:40:09 -0000 1.6
+++ DefaultMaven.java 25 Apr 2003 01:16:30 -0000 1.7
@@ -56,28 +56,33 @@
* ====================================================================
*/
-import com.werken.classworlds.ClassRealm;
-import com.werken.classworlds.ClassWorld;
-import com.werken.werkz.NoActionDefinitionException;
-import com.werken.werkz.UnattainableGoalException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.project.Project;
import org.apache.maven.project.builder.ProjectBuilder;
+import org.apache.maven.project.builder.ProjectUnmarshaller;
import org.apache.maven.verifier.ChecksumVerificationException;
import org.apache.maven.verifier.DependencyVerifier;
import org.apache.maven.verifier.LocalSettingsVerifier;
import org.apache.maven.verifier.RepoConfigException;
import org.apache.maven.verifier.UnsatisfiedDependencyException;
+import org.apache.plexus.context.DefaultPlexusContext;
import org.apache.plexus.logging.AbstractLogEnabled;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import com.werken.classworlds.ClassRealm;
+import com.werken.classworlds.ClassWorld;
+import com.werken.werkz.NoActionDefinitionException;
+import com.werken.werkz.UnattainableGoalException;
/**
* This class should represent the single place to access everything that
@@ -97,29 +102,12 @@
// This is the mediator and main point of entry for the guts of maven.
-public class DefaultMaven
- extends AbstractLogEnabled
- implements Serviceable, Maven
+public class DefaultMaven extends AbstractLogEnabled implements Serviceable, Maven
{
// ------------------------------------------------------------
// Constants
// ------------------------------------------------------------
- /** return code from command prompt when a goal isn't found */
- private static final int RC_NO_GOAL = 30;
-
- /** return code for bad repository configuration */
- private static final int RC_BAD_REPO = 40;
-
- /** return code for a goal with no actions */
- private static final int RC_EMPTY_GOAL = 50;
-
- /** return code for a goal that failed */
- private static final int RC_GOAL_FAILED = 60;
-
- /** return code for a failure due to anything else */
- private static final int RC_OTHER_FAILURE = 90;
-
/** */
private static final String ROOT_REALM = "root";
@@ -148,6 +136,9 @@
/** Plugin Manager. */
private PluginManager pluginManager;
+ /** Project Unmarshaller. */
+ ProjectUnmarshaller projectUnmarshaller;
+
/** Root project. */
private Project project;
@@ -193,9 +184,9 @@
}
/** Default Constructor. */
- public DefaultMaven( ClassWorld classWorld, Map messages )
+ public DefaultMaven(ClassWorld classWorld, Map messages)
{
- setOptions( messages );
+ setOptions(messages);
goalNames = new ArrayList();
// Move the realm retrieval to an initialization phase. It
@@ -203,9 +194,9 @@
try
{
- rootClassRealm = classWorld.getRealm( ROOT_REALM );
+ rootClassRealm = classWorld.getRealm(ROOT_REALM);
}
- catch ( Exception e )
+ catch (Exception e)
{
e.printStackTrace();
}
@@ -214,14 +205,13 @@
// ----------------------------------------------------------------------
// Lifecylce Management
// ----------------------------------------------------------------------
-
- public void service( ServiceManager serviceManager )
- throws ServiceException
+ public void service(ServiceManager serviceManager) throws ServiceException
{
- projectBuilder = (ProjectBuilder) serviceManager.lookup( ProjectBuilder.ROLE );
- dependencyVerifier = (DependencyVerifier) serviceManager.lookup( DependencyVerifier.ROLE );
- localSettingsVerifier = (LocalSettingsVerifier) serviceManager.lookup( LocalSettingsVerifier.ROLE );
- pluginManager = (PluginManager) serviceManager.lookup( PluginManager.ROLE );
+ projectBuilder = (ProjectBuilder) serviceManager.lookup(ProjectBuilder.ROLE);
+ projectUnmarshaller = (ProjectUnmarshaller) serviceManager.lookup(ProjectUnmarshaller.ROLE);
+ dependencyVerifier = (DependencyVerifier) serviceManager.lookup(DependencyVerifier.ROLE);
+ localSettingsVerifier = (LocalSettingsVerifier) serviceManager.lookup(LocalSettingsVerifier.ROLE);
+ pluginManager = (PluginManager) serviceManager.lookup(PluginManager.ROLE);
}
/** Perform pre-build initialization.
@@ -229,8 +219,7 @@
* @throws Exception If an error occurs while performing
* runtime initialization.
*/
- public void initialize()
- throws Exception
+ public void initialize() throws Exception
{
// Verfify the local settings.
localSettingsVerifier.verify();
@@ -240,19 +229,31 @@
// Project Processing.
// ----------------------------------------------------------------------
- public void setProjectFile( File projectFile )
+ public void setProjectFile(File projectFile)
{
this.projectFile = projectFile;
}
- public void setProject( Project project )
+ public void setProject(Project project)
{
this.project = project;
}
public Project getProject()
{
- return project;
+ try
+ {
+ if (project == null && projectFile != null)
+ {
+ project = projectUnmarshaller.parse(new FileReader(projectFile));
+ }
+ return project;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException(e.getLocalizedMessage());
+ }
}
/**
@@ -261,24 +262,25 @@
* @throws Exception If there is an error while
* reading the project descriptor.
*/
- private void initializeProject()
- throws Exception
+ private void initializeProject() throws Exception
{
- if ( projectFile != null )
+ if (projectFile != null)
{
- setProject( projectBuilder.build( projectFile ) );
+ setProject(projectBuilder.build(projectFile));
}
else
{
// A type of null pattern. We don't really have a root project per se
// but want the rest of the system to believe there is for consistency
// in the rest of the code.
+ // XXX but is it really a valid pattern to NOT have a project.xml?
+ // should we be bailing out at this point?
Project globalProject = new Project();
- globalProject.setId( "Global Project" );
- setProject( globalProject );
+ globalProject.setId("Global Project");
+ setProject(globalProject);
}
- getProject().setGoalNames( getGoalNames() );
+ getProject().setGoalNames(getGoalNames());
}
// ----------------------------------------------------------------------
@@ -290,7 +292,7 @@
return errorMessage;
}
- public void setErrorMessage( String errorMessage )
+ public void setErrorMessage(String errorMessage)
{
this.errorMessage = errorMessage;
}
@@ -300,7 +302,7 @@
return cause;
}
- public void setCause( Throwable cause )
+ public void setCause(Throwable cause)
{
this.cause = cause;
}
@@ -310,7 +312,7 @@
return rootCause;
}
- public void setRootCause( Throwable rootCause )
+ public void setRootCause(Throwable rootCause)
{
this.rootCause = rootCause;
}
@@ -324,7 +326,7 @@
return startTime;
}
- public void setStartTime( Date startTime )
+ public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
@@ -334,7 +336,7 @@
return endTime;
}
- public void setEndTime( Date endTime )
+ public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
@@ -344,7 +346,7 @@
return executionDuration;
}
- public void setExecutionDuration( long executionDuration )
+ public void setExecutionDuration(long executionDuration)
{
this.executionDuration = executionDuration;
}
@@ -361,13 +363,15 @@
// ----------------------------------------------------------------------
// Goal Processing
// ----------------------------------------------------------------------
-
- public void addGoal( String goal )
+ private List goals = new ArrayList();
+ public void addGoal(String goal)
{
+ goals.add(goal);
}
- public void addGoals( List goals )
+ public void addGoals(List goals)
{
+ this.goals.addAll(goals);
}
/** Retrieve the list of goal names.
@@ -384,9 +388,9 @@
*
* @param goalName Goal to attain.
*/
- public void addGoalName( String goalName )
+ public void addGoalName(String goalName)
{
- this.goalNames.add( goalName );
+ this.goalNames.add(goalName);
}
/**
@@ -394,9 +398,9 @@
*
* @param goalNames List of goals to attain.
*/
- public void addGoalNames( List goalNames )
+ public void addGoalNames(List goalNames)
{
- this.goalNames.addAll( goalNames );
+ this.goalNames.addAll(goalNames);
}
/**
@@ -404,10 +408,12 @@
*/
public void clearGoalNames()
{
- for ( int i = 0; i < goalNames.size(); i++ )
- {
- goalNames.remove( i );
- }
+ goalNames.clear();
+ // No idea why the next few lines were being done. Remove at some point.
+ // for ( int i = 0; i < goalNames.size(); i++ )
+ // {
+ // goalNames.remove( i );
+ // }
}
/**
@@ -416,7 +422,7 @@
* @param goalName Goal name to get the description for.
* @return Goal description.
*/
- public String getGoalDescription( String goalName )
+ public String getGoalDescription(String goalName)
{
//!!
@@ -435,13 +441,13 @@
*
* @return The return code.
*/
- private int handleUnattainableGoalException( UnattainableGoalException e )
+ private int handleUnattainableGoalException(UnattainableGoalException e)
{
- int returnCode = RC_GOAL_FAILED;
+ int returnCode = MavenReturnCodes.RC_GOAL_FAILED;
- setRootCause( e.getRootCause() );
+ setRootCause(e.getRootCause());
- if ( rootCause != null )
+ if (rootCause != null)
{
// JellyException was caught here.
}
@@ -451,7 +457,7 @@
public int start()
{
- setStartTime( new Date() );
+ setStartTime(new Date());
int returnCode = 0;
@@ -460,74 +466,77 @@
initialize();
attainGoals();
}
- catch ( UnsatisfiedDependencyException e )
+ catch (UnsatisfiedDependencyException e)
{
- setCause( e );
+ setCause(e);
}
- catch ( ChecksumVerificationException e )
+ catch (ChecksumVerificationException e)
{
- setCause( e );
+ setCause(e);
}
- catch ( UnknownGoalException e )
+ catch (UnknownGoalException e)
{
- setCause( e );
+ setCause(e);
- StringBuffer sb = new StringBuffer().
- append( "BUILD FAILED" ).append( "\n" ).
- append( "Goal '" + e.getGoalName() + "'" ).
- append( "does not exist in this project." );
+ StringBuffer sb =
+ new StringBuffer().append("BUILD FAILED").append("\n").append("Goal '" + e.getGoalName() + "'").append(
+ "does not exist in this project.");
- setErrorMessage( sb.toString() );
+ setErrorMessage(sb.toString());
- returnCode = RC_NO_GOAL;
+ returnCode = MavenReturnCodes.RC_NO_GOAL;
}
- catch ( RepoConfigException e )
+ catch (RepoConfigException e)
{
- setCause( e );
- System.err.println( e.getLocalizedMessage() );
- returnCode = RC_BAD_REPO;
+ setCause(e);
+ System.err.println(e.getLocalizedMessage());
+ returnCode = MavenReturnCodes.RC_BAD_REPO;
}
- catch ( NoActionDefinitionException e )
+ catch (NoActionDefinitionException e)
{
- setCause( e );
-
- StringBuffer sb = new StringBuffer().
+ setCause(e);
- append( "INTERNAL ERROR" ).
- append( "Reference made to goal " ).
- append( "'" + e.getGoal().getName() + "'" ).
- append( "which has no definition." ).
- append( "\n" );
+ StringBuffer sb =
+ new StringBuffer()
+ .append("INTERNAL ERROR")
+ .append("Reference made to goal ")
+ .append("'" + e.getGoal().getName() + "'")
+ .append("which has no definition.")
+ .append("\n");
- setErrorMessage( sb.toString() );
+ setErrorMessage(sb.toString());
- returnCode = RC_EMPTY_GOAL;
+ returnCode = MavenReturnCodes.RC_EMPTY_GOAL;
return -1;
}
- catch ( UnattainableGoalException e )
+ catch (UnattainableGoalException e)
{
- returnCode = handleUnattainableGoalException( e );
+ returnCode = handleUnattainableGoalException(e);
}
- // JellyException was here
- catch ( Exception e )
+ // JellyException was here
+ catch (Exception e)
{
- returnCode = RC_OTHER_FAILURE;
+ returnCode = MavenReturnCodes.RC_OTHER_FAILURE;
}
- setEndTime( new Date() );
- setExecutionDuration( getEndTime().getTime() - getStartTime().getTime() );
+ setEndTime(new Date());
+
+ //XXX why is this necessary - shouldn't it be computed?
+ setExecutionDuration(getEndTime().getTime() - getStartTime().getTime());
return returnCode;
}
// Once a set of goals have been attained should they be removed from
- // the list? Probably.
-
- public void attainGoals()
- throws UnknownGoalException, Exception
- {
- // This should be done by the maven component with a project.
- //getPluginManager().attainGoals( getRootProject() );
+ // the list? Probably. But what happens if a goal doesn't get attained?
+ // can we do anything about it?
+ public void attainGoals() throws UnknownGoalException, Exception
+ {
+ //FIXME BRW: Shouldn't be hardwired to plexus (I think)
+ DefaultPlexusContext context = new DefaultPlexusContext();
+ context.put(Project.CONTEXT_KEY, getRootProject());
+
+ getPluginManager().attainGoals(context, goals);
}
/**
@@ -536,8 +545,7 @@
* @throws UnknownGoalException
* @throws Exception
*/
- public void attainGoals( Project project )
- throws UnknownGoalException, Exception
+ public void attainGoals(Project project) throws UnknownGoalException, Exception
{
// This should be done by the maven component with a project.
//getPluginManager().attainGoals( project );
@@ -553,15 +561,14 @@
* @throws RepoConfigException If an error occurs checking the local settings.
* @throws UnsatisfiedDependencyException If an error occurs due to missing exceptions.
*/
- public void verifyDependencies( Project project )
- throws RepoConfigException,
- UnsatisfiedDependencyException,
- ChecksumVerificationException
+ public void verifyDependencies(Project project)
+ throws RepoConfigException, UnsatisfiedDependencyException, ChecksumVerificationException
{
// Only attempt to verify the dependencies if a project.xml file exists.
- if ( project.getFile() != null )
+ //XXX This makes the assumption that we are using a file
+ if (project.getFile() != null)
{
- dependencyVerifier.verify( project );
+ dependencyVerifier.verify(project);
}
}
@@ -574,7 +581,7 @@
return options;
}
- public void setOptions( Map options )
+ public void setOptions(Map options)
{
this.options = options;
}
@@ -592,7 +599,7 @@
*
* @param mavenHome
*/
- public void setMavenHome( File mavenHome )
+ public void setMavenHome(File mavenHome)
{
this.mavenHome = mavenHome;
}
@@ -610,8 +617,19 @@
*
* @param mavenRepoLocal
*/
- public void setMavenRepoLocal( File mavenRepoLocal )
+ public void setMavenRepoLocal(File mavenRepoLocal)
{
this.mavenRepoLocal = mavenRepoLocal;
}
+
+ public PluginManager getPluginManager()
+ {
+ return pluginManager;
+ }
+
+ public Project getRootProject()
+ {
+ return getProject();
+ }
+
}
1.2 +57 -6 maven-new/src/java/org/apache/maven/MavenReturnCodes.java
Index: MavenReturnCodes.java
===================================================================
RCS file: /home/cvs/maven-new/src/java/org/apache/maven/MavenReturnCodes.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MavenReturnCodes.java 24 Apr 2003 22:21:51 -0000 1.1
+++ MavenReturnCodes.java 25 Apr 2003 01:16:30 -0000 1.2
@@ -1,10 +1,60 @@
-/*
- * Created on 25/04/2003
+package org.apache.maven;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 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.
*
- * To change this generated comment go to
- * Window>Preferences>Java>Code Generation>Code Template
+ * 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 apache@apache.org.
+ *
+ * 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/>.
+ *
+ * ====================================================================
*/
-package org.apache.maven;
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
@@ -26,4 +76,5 @@
/** return code for a failure due to anything else */
public static final int RC_OTHER_FAILURE = 90;
+
}
1.2 +6 -2 maven-new/src/test/org/apache/maven/plugins/suiterunner/SuiteRunnerComponentTest.java
Index: SuiteRunnerComponentTest.java
===================================================================
RCS file: /home/cvs/maven-new/src/test/org/apache/maven/plugins/suiterunner/SuiteRunnerComponentTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SuiteRunnerComponentTest.java 21 Apr 2003 22:10:57 -0000 1.1
+++ SuiteRunnerComponentTest.java 25 Apr 2003 01:16:31 -0000 1.2
@@ -9,9 +9,11 @@
import java.io.InputStream;
import java.io.InputStreamReader;
+import org.apache.avalon.framework.context.Context;
import org.apache.maven.project.Project;
import org.apache.maven.project.builder.ProjectUnmarshaller;
import org.apache.plexus.PlexusTestCase;
+import org.apache.plexus.context.DefaultPlexusContext;
/**
* @author <a href="bwalding@jakarta.org">Ben Walding</a>
@@ -55,7 +57,9 @@
SuiteRunnerService srs = (SuiteRunnerService) o;
assertNotNull("project", testProject);
- srs.runTests("default", testProject);
+ DefaultPlexusContext context = new DefaultPlexusContext();
+ context.put("project", testProject);
+ srs.runTests(context);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org