You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2004/01/29 02:04:16 UTC
cvs commit: maven/src/java/org/apache/maven/plugin GoalToJellyScriptHousingMapper.java JellyScriptHousing.java PluginManager.java
brett 2004/01/28 17:04:16
Modified: src/java/org/apache/maven/cli Tag: MAVEN-1_0-BRANCH App.java
src/java/org/apache/maven/jelly/tags/maven Tag:
MAVEN-1_0-BRANCH ReactorTag.java
src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
GoalToJellyScriptHousingMapper.java
JellyScriptHousing.java PluginManager.java
Log:
show jelly info on failure, don't execute default goals in reactor if none given, as per RC1
Revision Changes Path
No revision
No revision
1.37.4.9 +5 -9 maven/src/java/org/apache/maven/cli/App.java
Index: App.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/cli/App.java,v
retrieving revision 1.37.4.8
retrieving revision 1.37.4.9
diff -u -r1.37.4.8 -r1.37.4.9
--- App.java 26 Jan 2004 23:36:08 -0000 1.37.4.8
+++ App.java 29 Jan 2004 01:04:15 -0000 1.37.4.9
@@ -720,6 +720,10 @@
msg = rootCause.getClass().getName();
}
}
+ System.err.println( "File...... " + fileName );
+ System.err.println( "Element... " + elementName );
+ System.err.println( "Line...... " + lineNumber );
+ System.err.println( "Column.... " + column );
}
else
{
@@ -735,14 +739,6 @@
else
{
msg = e.getLocalizedMessage();
- }
-
- if ( fileName != null )
- {
- System.err.println( "File...... " + fileName );
- System.err.println( "Element... " + elementName );
- System.err.println( "Line...... " + lineNumber );
- System.err.println( "Column.... " + column );
}
System.err.println( msg );
No revision
No revision
1.36.4.6 +3 -3 maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java
Index: ReactorTag.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java,v
retrieving revision 1.36.4.5
retrieving revision 1.36.4.6
diff -u -r1.36.4.5 -r1.36.4.6
--- ReactorTag.java 26 Jan 2004 23:36:09 -0000 1.36.4.5
+++ ReactorTag.java 29 Jan 2004 01:04:15 -0000 1.36.4.6
@@ -302,10 +302,10 @@
// We only try to attain goals if they have been set. The reactor
// might be in use to collect project information for the purpose
// of, say, generating a sites from a set of components.
- List goalList = new ArrayList();
+ List goalList = null;
if ( getGoals() != null )
{
- goalList.addAll( MavenUtils.getGoalListFromCsv( getGoals() ) );
+ goalList = MavenUtils.getGoalListFromCsv( getGoals() );
}
beforeLaunchGoals(project);
No revision
No revision
1.3.4.5 +1 -1 maven/src/java/org/apache/maven/plugin/Attic/GoalToJellyScriptHousingMapper.java
Index: GoalToJellyScriptHousingMapper.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/Attic/GoalToJellyScriptHousingMapper.java,v
retrieving revision 1.3.4.4
retrieving revision 1.3.4.5
diff -u -r1.3.4.4 -r1.3.4.5
--- GoalToJellyScriptHousingMapper.java 26 Jan 2004 23:32:27 -0000 1.3.4.4
+++ GoalToJellyScriptHousingMapper.java 29 Jan 2004 01:04:15 -0000 1.3.4.5
@@ -443,7 +443,7 @@
// This is essentially allowed for bootstrap so
// plugins can import taglibs they don't use until later
log.warn( "Tag library requested that is not present: '" + dynaTagUri + "' in plugin: '"
- + plugin.getId() + "'" );
+ + plugin.getProject().getId() + "'" );
}
else
{
1.3.4.4 +32 -17 maven/src/java/org/apache/maven/plugin/Attic/JellyScriptHousing.java
Index: JellyScriptHousing.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/Attic/JellyScriptHousing.java,v
retrieving revision 1.3.4.3
retrieving revision 1.3.4.4
diff -u -r1.3.4.3 -r1.3.4.4
--- JellyScriptHousing.java 26 Jan 2004 23:32:27 -0000 1.3.4.3
+++ JellyScriptHousing.java 29 Jan 2004 01:04:15 -0000 1.3.4.4
@@ -3,9 +3,11 @@
import com.werken.forehead.ForeheadClassLoader;
import org.apache.commons.jelly.Script;
import org.apache.maven.jelly.JellyUtils;
+import org.apache.maven.jelly.MavenJellyContext;
import org.apache.maven.project.Project;
import java.io.File;
+import java.net.URL;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -20,9 +22,6 @@
/** Jelly Script. */
private Script script;
- /** Id of the jelly script. @todo [RC2] no the same as a regular id - rename */
- private String id;
-
/** the source of the jelly script. @todo [RC2] not always set correctly */
private File source;
@@ -83,7 +82,7 @@
*
* @return
*/
- public Script getScript(PluginManager manager)
+ private Script getScript(PluginManager manager)
throws Exception
{
// TODO [RC2]: needs refactoring - don't do it all here
@@ -101,26 +100,42 @@
// We will add the plugin classes to the plugin class loader.
pluginClassLoader.addURL( source.getParentFile().toURL() );
manager.processDependencies(project, pluginClassLoader);
- script = JellyUtils.compileScript(source, project.getContext());
+
+ MavenJellyContext context = project.getContext();
+ URL oldRoot = context.getRootURL();
+ URL oldCurrent = context.getCurrentURL();
+
+ context.setRootURL( source.toURL() );
+ context.setCurrentURL( source.toURL() );
+
+ script = JellyUtils.compileScript(source, context);
+
+ context.setRootURL( oldRoot );
+ context.setCurrentURL( oldCurrent );
}
return script;
}
- public String getId()
+ public String toString()
{
- return id;
+ return "\n source = " + getSource() +
+ "\n project = " + getProject().getId() +
+ "\n script = " + script;
}
- public void setId( String id )
+ /**
+ * @param context
+ * @throws Exception
+ */
+ void run( PluginManager manager, MavenJellyContext context ) throws Exception
{
- this.id = id;
- }
+ // TODO: pass in context?
+ Script s = getScript( manager );
- public String toString()
- {
- return "\n id = " + getId() +
- "\n source = " + getSource() +
- "\n project = " + getProject().getId() +
- "\n script = " + script;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader( context.getClassLoader() );
+ s.run( context, context.getXMLOutput() );
+ Thread.currentThread().setContextClassLoader( loader );
}
+
}
1.70.4.12 +12 -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.70.4.11
retrieving revision 1.70.4.12
diff -u -r1.70.4.11 -r1.70.4.12
--- PluginManager.java 27 Jan 2004 22:29:12 -0000 1.70.4.11
+++ PluginManager.java 29 Jan 2004 01:04:15 -0000 1.70.4.12
@@ -83,6 +83,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -348,7 +349,6 @@
private JellyScriptHousing createJellyScriptHousing( JellyPlugin plugin ) throws MalformedURLException, Exception
{
JellyScriptHousing jellyScriptHousing = new JellyScriptHousing();
- jellyScriptHousing.setId( plugin.getId() );
jellyScriptHousing.setProject( plugin.getProject() );
jellyScriptHousing.setSource( plugin.getScriptFile() );
@@ -386,14 +386,10 @@
Script script = null;
// Projects may not have a maven.xml file.
- if ( jelly != null )
- {
- script = JellyUtils.compileScript( jelly, project.getContext() );
- }
+ script = JellyUtils.compileScript( jelly, project.getContext() );
jellyScriptHousing.setProject( project );
jellyScriptHousing.setScript( script );
- jellyScriptHousing.setId( project.getId() );
return jellyScriptHousing;
}
@@ -424,7 +420,6 @@
jellyScriptHousing.setProject( project );
jellyScriptHousing.setSource( jelly );
- jellyScriptHousing.setId( project.getId() );
return jellyScriptHousing;
}
@@ -457,7 +452,7 @@
}
// get correct classloader
- String dependencyClassLoader = artifact.getDependency().getProperty( "classloader" );
+ String dependencyClassLoader = dependency.getProperty( "classloader" );
// add to classloader
if ( artifact.exists() )
@@ -584,8 +579,8 @@
p = p.getParent();
}
- // Default goal handling
- if ( goals.size() == 0 )
+ // Default goal handling - if goals are null, don't even process the default
+ if ( goals != null && goals.size() == 0 )
{
String defaultGoalName = transientMapper.getDefaultGoalName();
@@ -594,6 +589,10 @@
goals.add( defaultGoalName );
}
}
+ if ( goals == null )
+ {
+ goals = Collections.EMPTY_LIST;
+ }
transientMapper.merge( mapper );
transientMapper.addResolvedPlugins( projectHousings );
@@ -615,7 +614,7 @@
for ( Iterator j = projectHousings.iterator(); j.hasNext(); )
{
JellyScriptHousing housing = ( JellyScriptHousing ) j.next();
- runJellyScriptHousing( housing, baseContext );
+ housing.run( this, baseContext );
}
Set pluginSet = prepAttainGoal( goalName, baseContext, transientMapper );
@@ -691,25 +690,9 @@
housings.put( housing.getProject().getArtifactId(), housing );
- runJellyScriptHousing( housing, pluginContext );
+ housing.run( this, pluginContext );
}
return pluginSet;
- }
-
- /**
- * @param jellyScriptHousing
- * @param context
- * @throws Exception
- */
- private void runJellyScriptHousing( JellyScriptHousing jellyScriptHousing, MavenJellyContext context )
- throws Exception
- {
- Script s = jellyScriptHousing.getScript( this );
-
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader( context.getClassLoader() );
- s.run( context, context.getXMLOutput() );
- Thread.currentThread().setContextClassLoader( loader );
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org