jvanzyl 2003/07/29 20:34:24
Modified: src/java/org/apache/maven/plugin PluginManager.java
Log:
o Clean up the default goal handling. We must process the
maven.xml file before a default goal is available to add to the set
of goals to be attained.
Revision Changes Path
1.57 +24 -29 maven/src/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- PluginManager.java 29 Jul 2003 06:47:07 -0000 1.56
+++ PluginManager.java 30 Jul 2003 03:34:24 -0000 1.57
@@ -73,7 +73,6 @@
import org.apache.maven.Maven;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenException;
-import org.apache.maven.NoGoalException;
import org.apache.maven.jelly.JellyBuildListener;
import org.apache.maven.jelly.JellyPropsHandler;
import org.apache.maven.jelly.JellyUtils;
@@ -301,7 +300,7 @@
private void loadPlugin( String name )
throws Exception
{
- System.err.println("Loading plugin '" + name + "'");
+ System.err.println( "Loading plugin '" + name + "'" );
if ( isLoaded( name ) )
{
return;
@@ -334,9 +333,9 @@
// Create the PluginHousing
jellyScriptHousing = createJellyScriptHousing( pluginProject,
unpackedPluginDir, jellyScript );
}
- catch (Exception e)
+ catch ( Exception e )
{
- System.err.println("Error loading plugin '" + name + "'");
+ System.err.println( "Error loading plugin '" + name + "'" );
throw e;
}
@@ -376,24 +375,6 @@
// if desired.
project.verifyDependencies();
-
- if ( goals.size() == 0 )
- {
- if ( baseContext.getWerkzProject() == null )
- {
- throw new NoGoalException( "No goal specified and no project.xml
found." );
- }
- else
- {
- String defaultGoalName = mapper.getDefaultGoalName();
-
- if ( defaultGoalName != null )
- {
- goals.add( defaultGoalName );
- }
- }
- }
-
// Set up the ant project.
build( project, baseContext );
Path p = new Path( baseContext.getAntProject() );
@@ -439,7 +420,7 @@
// driver.jelly
InputStream driver =
PluginManager.class.getClassLoader().getResourceAsStream( "driver.jelly" );
JellyScriptHousing driverHousing = createJellyScriptHousing( project, null,
driver );
- driverHousing.setSource("driver.jelly");
+ driverHousing.setSource( "driver.jelly" );
//mapper.parse( new InputStreamReader( driver ), driverHousing );
runJellyScriptHousing( driverHousing, baseContext );
@@ -471,6 +452,20 @@
}
}
+ // ----------------------------------------------------------------------
+ // Default goal handling
+ // ----------------------------------------------------------------------
+
+ if ( goals.size() == 0 )
+ {
+ String defaultGoalName = mapper.getDefaultGoalName();
+
+ if ( defaultGoalName != null )
+ {
+ goals.add( defaultGoalName );
+ }
+ }
+
// Plugin Jelly scripts
for ( Iterator i = goals.iterator(); i.hasNext(); )
{
@@ -515,16 +510,16 @@
{
// DG HACK 1
ClassLoader loader =
Thread.currentThread().getContextClassLoader();
-
Thread.currentThread().setContextClassLoader(jellyScriptHousing.getClassLoader());
+ Thread.currentThread().setContextClassLoader(
jellyScriptHousing.getClassLoader() );
// END DG HACK 1
jellyScriptHousing.getScript().run( context,
getJellyOutputSink() );
// DG HACK 2
- Thread.currentThread().setContextClassLoader(loader);
+ Thread.currentThread().setContextClassLoader( loader );
// END DG HACK 2
}
- catch (Exception e)
+ catch ( Exception e )
{
- System.err.println("Error running '" +
jellyScriptHousing.getSource() + "'");
+ System.err.println( "Error running '" +
jellyScriptHousing.getSource() + "'" );
throw e;
}
}
@@ -548,7 +543,7 @@
// ${plugin.resources}
Project project = jellyScriptHousing.getProject();
- File projectFile = project.getFile();
+ File projectFile = project.getFile();
File unpackedPluginDir = projectFile.getParentFile();
MavenJellyContext pluginContext = new MavenJellyContext( parent );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]