You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by jd...@apache.org on 2005/03/07 20:03:19 UTC
cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/util/introspection ReflectionValueExtractor.java
jdcasey 2005/03/07 11:03:19
Modified: maven-mboot2/src/main/java MBoot.java
maven-core/src/test/java/org/apache/maven/plugin
PluginParameterExpressionEvaluatorTest.java
maven-core/src/main/resources/META-INF/plexus components.xml
maven-core/src/main/java/org/apache/maven/execution
MavenSession.java
maven-core/src/main/java/org/apache/maven/plugin
DefaultPluginManager.java PluginManager.java
maven-core/src/main/java/org/apache/maven/lifecycle
DefaultLifecycleExecutor.java
maven-core/src/main/java/org/apache/maven/project/injection
DefaultModelDefaultsInjector.java
maven-core/src/test/java/org/apache/maven/project/inheritance
DefaultModelInheritanceAssemblerTest.java
maven-core/src/test/java/org/apache/maven MavenTestCase.java
maven-core/src/main/java/org/apache/maven/project
MavenProject.java
maven-model maven.mdo
maven-core/src/main/java/org/apache/maven DefaultMaven.java
Maven.java
maven-core/src/main/java/org/apache/maven/project/inheritance
DefaultModelInheritanceAssembler.java
maven-core/src/main/java/org/apache/maven/util/introspection
ReflectionValueExtractor.java
Added: maven-core/src/main/java/org/apache/maven/lifecycle
GoalExecutionException.java
GoalNotFoundException.java
Removed: maven-core/src/main/java/org/apache/maven/lifecycle/goal
MavenGoalPhase.java MavenGoalPhaseManager.java
AbstractMavenGoalPhase.java
GoalNotFoundException.java
GoalExecutionException.java
DefaultMavenGoalPhaseManager.java
MavenGoalExecutionContext.java
maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase
GoalAssemblySubProcessTest.java
maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase
PluginResolutionPhase.java GoalMappingPhase.java
DependencyResolutionPhase.java
GoalResolutionPhase.java GoalAttainmentPhase.java
DependencyDownloadPhase.java
maven-core/src/main/java/org/apache/maven/lifecycle/session/phase
GoalExecutionPhase.java
maven-core/src/test/java/org/apache/maven/lifecycle
MavenLifecycleManagerTest.java
maven-core/src/main/java/org/apache/maven/util
GoalVisitor.java AbstractGoalVisitor.java
GraphTraversalException.java GoalWalker.java
maven-core/src/main/java/org/apache/maven/lifecycle/session
MavenSessionPhase.java
MavenSessionPhaseManager.java
AbstractMavenSessionPhase.java
DefaultMavenSessionPhaseManager.java
Log:
o Added <pluginManagement/>
o Removed goal decoration.
Revision Changes Path
1.57 +23 -2 maven-components/maven-mboot2/src/main/java/MBoot.java
Index: MBoot.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- MBoot.java 5 Mar 2005 14:52:11 -0000 1.56
+++ MBoot.java 7 Mar 2005 19:03:18 -0000 1.57
@@ -20,6 +20,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -146,9 +147,29 @@
public static void main( String[] args ) throws Exception
{
- MBoot mboot = new MBoot();
+ try
+ {
+ MBoot mboot = new MBoot();
- mboot.run( args );
+ mboot.run( args );
+ }
+ catch ( InvocationTargetException e )
+ {
+ Throwable target = e.getTargetException();
+
+ if(target instanceof RuntimeException)
+ {
+ throw (RuntimeException)target;
+ }
+ else if(target instanceof Exception)
+ {
+ throw (Exception)target;
+ }
+ else
+ {
+ throw new RuntimeException(target);
+ }
+ }
}
public void run( String[] args ) throws Exception
1.4 +43 -11 maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
Index: PluginParameterExpressionEvaluatorTest.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PluginParameterExpressionEvaluatorTest.java 16 Feb 2005 07:16:33 -0000 1.3
+++ PluginParameterExpressionEvaluatorTest.java 7 Mar 2005 19:03:18 -0000 1.4
@@ -2,11 +2,16 @@
import org.apache.maven.MavenTestCase;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.monitor.event.DefaultEventDispatcher;
+import org.apache.maven.monitor.logging.DefaultLog;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
+import org.codehaus.plexus.PlexusContainer;
import java.io.File;
+import java.util.Collections;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -17,8 +22,6 @@
{
private MavenProject project;
- private MavenGoalExecutionContext context;
-
protected void setUp()
throws Exception
{
@@ -27,18 +30,36 @@
File f = getTestFile( "src/test/resources/pom.xml" );
project = getProject( f );
-
- context = createGoalExecutionContext();
}
public void testValueExtractionWithAPomValueContainingAPath()
throws Exception
{
- Object value = PluginParameterExpressionEvaluator.evaluate( "#project.build.directory/classes", context.getSession() );
-
String expected = getTestFile( "target/test-classes/target/classes" ).getCanonicalPath();
+ ArtifactRepository repo = new ArtifactRepository("local", "here");
+ PluginManager mgr = (PluginManager)lookup(PluginManager.ROLE);
+
+ PlexusContainer container = getContainer();
+ MavenSession session = new MavenSession(container, mgr, repo, new DefaultEventDispatcher(), new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
+
+ Build build = new Build();
+ build.setDirectory(expected.substring(0, expected.length() - "/classes".length()));
+
+ Model model = new Model();
+ model.setBuild(build);
+
+ MavenProject project = new MavenProject(model);
+ project.setFile(new File("pom.xml").getCanonicalFile());
+
+ session.setProject(project);
+
+ Object value = PluginParameterExpressionEvaluator.evaluate( "#project.build.directory/classes", session );
+
String actual = new File( value.toString() ).getCanonicalPath();
+
+ System.out.println("Expected value: " + expected);
+ System.out.println("Resolved value: " + actual);
assertEquals( expected, actual );
}
@@ -48,7 +69,12 @@
{
String role = "#component.org.apache.maven.project.MavenProjectBuilder";
- Object value = PluginParameterExpressionEvaluator.evaluate( role, context.getSession() );
+ ArtifactRepository repo = new ArtifactRepository();
+ PluginManager mgr = (PluginManager)lookup(PluginManager.ROLE);
+
+ PlexusContainer container = getContainer();
+ MavenSession session = new MavenSession(container, mgr, repo, new DefaultEventDispatcher(), new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
+ Object value = PluginParameterExpressionEvaluator.evaluate( role, session );
assertNotNull( value );
}
@@ -56,7 +82,13 @@
public void testLocalRepositoryExtraction()
throws Exception
{
- Object value = PluginParameterExpressionEvaluator.evaluate( "#localRepository", context.getSession() );
+ ArtifactRepository repo = new ArtifactRepository("local", "target/repo");
+ PluginManager mgr = (PluginManager)lookup(PluginManager.ROLE);
+
+ PlexusContainer container = getContainer();
+ MavenSession session = new MavenSession(container, mgr, repo, new DefaultEventDispatcher(), new DefaultLog(container.getLogger()), Collections.EMPTY_LIST);
+
+ Object value = PluginParameterExpressionEvaluator.evaluate( "#localRepository", session );
assertEquals( "local", ((ArtifactRepository)value).getId() );
}
1.17 +0 -36 maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml
Index: components.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- components.xml 1 Mar 2005 04:35:54 -0000 1.16
+++ components.xml 7 Mar 2005 19:03:18 -0000 1.17
@@ -19,9 +19,6 @@
<role>org.apache.maven.project.MavenProjectBuilder</role>
</requirement>
<requirement>
- <role>org.apache.maven.lifecycle.session.MavenSessionPhaseManager</role>
- </requirement>
- <requirement>
<role>org.apache.maven.lifecycle.LifecycleExecutor</role>
</requirement>
</requirements>
@@ -44,39 +41,6 @@
|
-->
<component>
- <role>org.apache.maven.lifecycle.session.MavenSessionPhaseManager</role>
- <implementation>org.apache.maven.lifecycle.session.DefaultMavenSessionPhaseManager</implementation>
- <configuration>
- <lifecycle-phases>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.session.phase.GoalExecutionPhase"/>
- </lifecycle-phases>
- </configuration>
- </component>
- <!--
- |
- |
- |
- -->
- <component>
- <role>org.apache.maven.lifecycle.goal.MavenGoalPhaseManager</role>
- <implementation>org.apache.maven.lifecycle.goal.DefaultMavenGoalPhaseManager</implementation>
- <configuration>
- <lifecycle-phases>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.PluginResolutionPhase"/>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalMappingPhase"/>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalResolutionPhase"/>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.DependencyResolutionPhase"/>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.DependencyDownloadPhase"/>
- <lifecycle-phase implementation="org.apache.maven.lifecycle.goal.phase.GoalAttainmentPhase"/>
- </lifecycle-phases>
- </configuration>
- </component>
- <!--
- |
- |
- |
- -->
- <component>
<role>org.apache.maven.project.interpolation.ModelInterpolator</role>
<implementation>org.apache.maven.project.interpolation.RegexBasedModelInterpolator</implementation>
</component>
1.5 +14 -102 maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
Index: MavenSession.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MavenSession.java 4 Mar 2005 09:04:14 -0000 1.4
+++ MavenSession.java 7 Mar 2005 19:03:18 -0000 1.5
@@ -18,8 +18,6 @@
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.PostGoal;
-import org.apache.maven.model.PreGoal;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.logging.Log;
import org.apache.maven.plugin.PluginManager;
@@ -32,12 +30,9 @@
import org.codehaus.plexus.util.dag.TopologicalSorter;
import org.codehaus.plexus.util.dag.Vertex;
-import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.TreeMap;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@@ -67,12 +62,8 @@
private Log log;
- public MavenSession( PlexusContainer container,
- PluginManager pluginManager,
- ArtifactRepository localRepository,
- EventDispatcher eventDispatcher,
- Log log,
- List goals )
+ public MavenSession( PlexusContainer container, PluginManager pluginManager, ArtifactRepository localRepository,
+ EventDispatcher eventDispatcher, Log log, List goals )
{
this.container = container;
@@ -81,7 +72,7 @@
this.localRepository = localRepository;
this.eventDispatcher = eventDispatcher;
-
+
this.log = log;
this.dag = new DAG();
@@ -107,16 +98,6 @@
public void setProject( MavenProject project )
{
this.project = project;
-
- // ----------------------------------------------------------------------
- // We only need these things to be done when we have a project.
- // ----------------------------------------------------------------------
-
- this.preGoalMappings = new TreeMap();
-
- this.postGoalMappings = new TreeMap();
-
- initGoalDecoratorMappings();
}
public ArtifactRepository getLocalRepository()
@@ -143,14 +124,12 @@
//
// ----------------------------------------------------------------------
- public Object lookup( String role )
- throws ComponentLookupException
+ public Object lookup( String role ) throws ComponentLookupException
{
return container.lookup( role );
}
- public Object lookup( String role, String roleHint )
- throws ComponentLookupException
+ public Object lookup( String role, String roleHint ) throws ComponentLookupException
{
return container.lookup( role, roleHint );
}
@@ -170,89 +149,22 @@
}
}
}
-
+
public EventDispatcher getEventDispatcher()
{
return eventDispatcher;
}
-
+
public Log getLog()
{
return log;
}
- //!! this should probably not be done here as there are request types that
- // have no project
-
- public List getPreGoals( String goal )
- {
- if ( project == null )
- {
- return null;
- }
-
- List result = (List) preGoalMappings.get( goal );
-
- return result;
- }
-
- public List getPostGoals( String goal )
- {
- if ( project == null )
- {
- return null;
- }
-
- List result = (List) postGoalMappings.get( goal );
-
- return result;
- }
-
- private void initGoalDecoratorMappings()
- {
- List allPreGoals = project.getPreGoals();
-
- for ( Iterator it = allPreGoals.iterator(); it.hasNext(); )
- {
- PreGoal preGoal = (PreGoal) it.next();
-
- List preGoalList = (List) preGoalMappings.get( preGoal.getName() );
-
- if ( preGoalList == null )
- {
- preGoalList = new LinkedList();
-
- preGoalMappings.put( preGoal.getName(), preGoalList );
- }
-
- preGoalList.add( preGoal.getAttain() );
- }
-
- List allPostGoals = project.getPostGoals();
-
- for ( Iterator it = allPostGoals.iterator(); it.hasNext(); )
- {
- PostGoal postGoal = (PostGoal) it.next();
-
- List postGoalList = (List) postGoalMappings.get( postGoal.getName() );
-
- if ( postGoalList == null )
- {
- postGoalList = new LinkedList();
-
- postGoalMappings.put( postGoal.getName(), postGoalList );
- }
-
- postGoalList.add( postGoal.getAttain() );
- }
- }
-
- public void addImpliedExecution( String goal, String implied )
- throws CycleDetectedException
+ public void addImpliedExecution( String goal, String implied ) throws CycleDetectedException
{
dag.addEdge( goal, implied );
}
-
+
public void addSingleExecution( String goal )
{
dag.addVertex( goal );
@@ -261,13 +173,13 @@
public List getExecutionChain( String goal )
{
Vertex vertex = dag.getVertex( goal );
-
+
List sorted = TopologicalSorter.sort( vertex );
-
+
int goalIndex = sorted.indexOf( goal );
-
+
List chainToHere = sorted.subList( 0, goalIndex + 1 );
-
+
return chainToHere;
}
1.41 +51 -53 maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Index: DefaultPluginManager.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- DefaultPluginManager.java 7 Mar 2005 07:22:49 -0000 1.40
+++ DefaultPluginManager.java 7 Mar 2005 19:03:18 -0000 1.41
@@ -1,19 +1,15 @@
package org.apache.maven.plugin;
-/* ====================================================================
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * ====================================================================
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
* ====================================================================
*/
@@ -28,7 +24,7 @@
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.goal.GoalExecutionException;
+import org.apache.maven.lifecycle.GoalExecutionException;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -103,9 +99,9 @@
/**
* Mojo descriptors are looked up using their id which is of the form
- * <pluginId>:<mojoId>. So this might be archetype:create for example which
+ * <pluginId>: <mojoId>. So this might be archetype:create for example which
* is the create mojo that resides in the archetype plugin.
- *
+ *
* @param name
* @return
*/
@@ -125,8 +121,7 @@
private Set pluginsInProcess = new HashSet();
- public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor )
- throws CycleDetectedException
+ public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor ) throws CycleDetectedException
{
if ( pluginsInProcess.contains( mavenPluginDescriptor.getPluginId() ) )
{
@@ -157,7 +152,7 @@
{
ComponentSetDescriptor componentSetDescriptor = event.getComponentSetDescriptor();
- if ( !( componentSetDescriptor instanceof MavenPluginDescriptor ) )
+ if ( !(componentSetDescriptor instanceof MavenPluginDescriptor) )
{
return;
}
@@ -194,8 +189,7 @@
}
// TODO: don't throw Exception
- public void verifyPluginForGoal( String goalName, MavenSession session )
- throws Exception
+ public void verifyPluginForGoal( String goalName, MavenSession session ) throws Exception
{
String pluginId = getPluginId( goalName );
@@ -203,8 +197,7 @@
}
// TODO: don't throw Exception
- public void verifyPlugin( String pluginId, MavenSession session )
- throws Exception
+ public void verifyPlugin( String pluginId, MavenSession session ) throws Exception
{
if ( !isPluginInstalled( pluginId ) )
{
@@ -223,8 +216,7 @@
}
// TODO: don't throw Exception
- protected void addPlugin( Artifact pluginArtifact, MavenSession session )
- throws Exception
+ protected void addPlugin( Artifact pluginArtifact, MavenSession session ) throws Exception
{
// TODO: these should be configured, not instantiated here
@@ -234,17 +226,19 @@
MavenMetadataSource metadataSource = new MavenMetadataSource( artifactResolver, mavenProjectBuilder );
- ( (ArtifactEnabledContainer) container ).addComponent( pluginArtifact, artifactResolver,
- remotePluginRepositories, session.getLocalRepository(),
- metadataSource, artifactFilter );
+ ((ArtifactEnabledContainer) container).addComponent( pluginArtifact,
+ artifactResolver,
+ remotePluginRepositories,
+ session.getLocalRepository(),
+ metadataSource,
+ artifactFilter );
}
// ----------------------------------------------------------------------
// Plugin execution
// ----------------------------------------------------------------------
- public PluginExecutionResponse executeMojo( MavenSession session, String goalName )
- throws GoalExecutionException
+ public PluginExecutionResponse executeMojo( MavenSession session, String goalName ) throws GoalExecutionException
{
try
{
@@ -281,7 +275,7 @@
try
{
-// getLogger().info( "[" + mojoDescriptor.getId() + "]" );
+ // getLogger().info( "[" + mojoDescriptor.getId() + "]" );
request = new PluginExecutionRequest( DefaultPluginManager.createParameters( mojoDescriptor, session ) );
@@ -299,7 +293,7 @@
try
{
plugin = (Plugin) container.lookup( Plugin.ROLE, goalName );
-
+
// !! This is ripe for refactoring to an aspect.
// Event monitoring.
String event = MavenEvents.MOJO_EXECUTION;
@@ -309,10 +303,10 @@
try
{
plugin.execute( request, response );
-
+
dispatcher.dispatchEnd( event, goalName );
}
- catch(Exception e)
+ catch ( Exception e )
{
session.getEventDispatcher().dispatchError( event, goalName, e );
throw e;
@@ -336,8 +330,7 @@
}
// TODO: don't throw Exception
- private void releaseComponents( MojoDescriptor goal, PluginExecutionRequest request )
- throws Exception
+ private void releaseComponents( MojoDescriptor goal, PluginExecutionRequest request ) throws Exception
{
if ( request != null && request.getParameters() != null )
{
@@ -363,8 +356,7 @@
// Mojo Parameter Handling
// ----------------------------------------------------------------------
- public static Map createParameters( MojoDescriptor goal, MavenSession session )
- throws PluginConfigurationException
+ public static Map createParameters( MojoDescriptor goal, MavenSession session ) throws PluginConfigurationException
{
Map map = null;
@@ -412,7 +404,8 @@
// ----------------------------------------------------------------------
// We will perform a basic check here for parameters values that are
// required. Required parameters can't be null so we throw an
- // Exception in the case where they are. We probably want some pluggable
+ // Exception in the case where they are. We probably want some
+ // pluggable
// mechanism here but this will catch the most obvious of
// misconfigurations.
// ----------------------------------------------------------------------
@@ -456,8 +449,10 @@
{
StringBuffer message = new StringBuffer();
- message.append( "The '" + parameter.getName() ).append( "' parameter is required for the execution of the " ).append(
- mojo.getId() ).append( " mojo and cannot be null." );
+ message.append( "The '" + parameter.getName() )
+ .append( "' parameter is required for the execution of the " )
+ .append( mojo.getId() )
+ .append( " mojo and cannot be null." );
return message.toString();
}
@@ -466,9 +461,7 @@
// Lifecycle
// ----------------------------------------------------------------------
-
- public void contextualize( Context context )
- throws ContextException
+ public void contextualize( Context context ) throws ContextException
{
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
@@ -476,10 +469,17 @@
public void initialize()
{
// TODO: configure this from bootstrap or scan lib
- artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model",
- "maven-monitor", "maven-plugin", "plexus-container-api",
- "plexus-container-default", "plexus-artifact-container",
- "wagon-provider-api", "classworlds"} );
+ artifactFilter = new ExclusionSetFilter( new String[] {
+ "maven-core",
+ "maven-artifact",
+ "maven-model",
+ "maven-monitor",
+ "maven-plugin",
+ "plexus-container-api",
+ "plexus-container-default",
+ "plexus-artifact-container",
+ "wagon-provider-api",
+ "classworlds" } );
// TODO: move this to be configurable from the Maven component
remotePluginRepositories = new HashSet();
@@ -492,8 +492,7 @@
// Artifact resolution
// ----------------------------------------------------------------------
- private void resolveTransitiveDependencies( MavenSession context )
- throws ArtifactResolutionException
+ private void resolveTransitiveDependencies( MavenSession context ) throws ArtifactResolutionException
{
MavenProject project = context.getProject();
@@ -511,8 +510,7 @@
// Artifact downloading
// ----------------------------------------------------------------------
- private void downloadDependencies( MavenSession context )
- throws GoalExecutionException
+ private void downloadDependencies( MavenSession context ) throws GoalExecutionException
{
try
{
1.16 +7 -10 maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- PluginManager.java 3 Mar 2005 11:42:30 -0000 1.15
+++ PluginManager.java 7 Mar 2005 19:03:18 -0000 1.16
@@ -18,30 +18,27 @@
*/
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.goal.GoalExecutionException;
+import org.apache.maven.lifecycle.GoalExecutionException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id$
*/
public interface PluginManager
{
String ROLE = PluginManager.class.getName();
- PluginExecutionResponse executeMojo( MavenSession session, String goalName )
- throws GoalExecutionException;
+ PluginExecutionResponse executeMojo( MavenSession session, String goalName ) throws GoalExecutionException;
MojoDescriptor getMojoDescriptor( String goalId );
// TODO: don't throw Exception
- void verifyPluginForGoal( String goalName, MavenSession session )
- throws Exception;
+ void verifyPluginForGoal( String goalName, MavenSession session ) throws Exception;
// TODO: don't throw Exception
- void verifyPlugin( String pluginId, MavenSession session )
- throws Exception;
+ void verifyPlugin( String pluginId, MavenSession session ) throws Exception;
PluginDescriptor getPluginDescriptor( String pluginId );
-}
+}
\ No newline at end of file
1.17 +26 -28 maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Index: DefaultLifecycleExecutor.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DefaultLifecycleExecutor.java 4 Mar 2005 09:04:25 -0000 1.16
+++ DefaultLifecycleExecutor.java 7 Mar 2005 19:03:18 -0000 1.17
@@ -22,7 +22,6 @@
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.goal.GoalExecutionException;
import org.apache.maven.model.Plugin;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
@@ -41,8 +40,9 @@
import java.util.Map;
/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
+ * @version $Id: DefaultLifecycleExecutor.java,v 1.16 2005/03/04 09:04:25
+ * jdcasey Exp $
*/
public class DefaultLifecycleExecutor
implements LifecycleExecutor, Initializable
@@ -68,9 +68,9 @@
// ----------------------------------------------------------------------
/**
- * Execute a list of tasks. Each task may be a phase in the lifecycle
- * or the execution of a mojo.
- *
+ * Execute a list of tasks. Each task may be a phase in the lifecycle or the
+ * execution of a mojo.
+ *
* @param tasks
* @param session
*/
@@ -82,12 +82,14 @@
try
{
- // TODO: should enrich this with the type handler, but for now just use "type" as is
+ // TODO: should enrich this with the type handler, but for now just
+ // use "type" as is
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( session.getProject().getType() );
if ( handler != null )
{
- // TODO: perhaps each type should define their own lifecycle completely, using the base as a default?
+ // TODO: perhaps each type should define their own lifecycle
+ // completely, using the base as a default?
// If so, remove both of these goals from type handler
if ( handler.packageGoal() != null )
{
@@ -139,15 +141,15 @@
}
// TODO: don't throw Exception
- private void processPluginConfiguration( MavenProject project, MavenSession mavenSession )
- throws Exception
+ private void processPluginConfiguration( MavenProject project, MavenSession mavenSession ) throws Exception
{
for ( Iterator i = project.getPlugins().iterator(); i.hasNext(); )
{
Plugin plugin = (Plugin) i.next();
- // TODO: should this flag be used in verifyPlugin, completely disabling the plugin?
- if ( !plugin.isDisabled() )
+ // TODO: should this flag be used in verifyPlugin, completely
+ // disabling the plugin?
+ if ( Boolean.TRUE != plugin.isDisabled() )
{
String pluginId = plugin.getId();
processPluginPhases( pluginId, mavenSession );
@@ -156,8 +158,7 @@
}
// TODO: don't throw Exception
- private void processPluginPhases( String pluginId, MavenSession mavenSession )
- throws Exception
+ private void processPluginPhases( String pluginId, MavenSession mavenSession ) throws Exception
{
pluginManager.verifyPlugin( pluginId, mavenSession );
PluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptor( pluginId );
@@ -165,7 +166,8 @@
{
MojoDescriptor mojoDescriptor = (MojoDescriptor) j.next();
- // TODO: check if the goal exists in the configuration and is disabled
+ // TODO: check if the goal exists in the configuration and is
+ // disabled
if ( mojoDescriptor.getPhase() != null )
{
Phase phase = (Phase) phaseMap.get( mojoDescriptor.getPhase() );
@@ -175,8 +177,7 @@
}
- private void processGoalChain( String task, MavenSession session )
- throws Exception
+ private void processGoalChain( String task, MavenSession session ) throws Exception
{
if ( phaseMap.containsKey( task ) )
{
@@ -204,8 +205,7 @@
}
}
- private void verifyMojoPhase( String task, MavenSession session )
- throws Exception
+ private void verifyMojoPhase( String task, MavenSession session ) throws Exception
{
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( task );
if ( mojoDescriptor == null )
@@ -232,11 +232,11 @@
int index = phases.indexOf( phaseMap.get( phase ) );
EventDispatcher dispatcher = session.getEventDispatcher();
-
+
for ( int j = 0; j <= index; j++ )
{
Phase p = (Phase) phases.get( j );
-
+
String event = MavenEvents.PHASE_EXECUTION;
// !! This is ripe for refactoring to an aspect.
@@ -259,21 +259,20 @@
}
}
}
-
+
dispatcher.dispatchEnd( event, p.getId() );
}
catch ( LifecycleExecutionException e )
{
dispatcher.dispatchError( event, p.getId(), e );
-
+
throw e;
}
// End event monitoring.
}
}
- protected PluginExecutionResponse executeMojo( String id, MavenSession session )
- throws LifecycleExecutionException
+ protected PluginExecutionResponse executeMojo( String id, MavenSession session ) throws LifecycleExecutionException
{
// ----------------------------------------------------------------------
// We have something of the form <pluginId>:<mojoId>, so this might be
@@ -312,8 +311,7 @@
// Lifecylce Management
// ----------------------------------------------------------------------
- public void initialize()
- throws Exception
+ public void initialize() throws Exception
{
phaseMap = new HashMap();
@@ -324,4 +322,4 @@
phaseMap.put( p.getId(), p );
}
}
-}
+}
\ No newline at end of file
1.1 maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/GoalExecutionException.java
Index: GoalExecutionException.java
===================================================================
package org.apache.maven.lifecycle;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id: GoalExecutionException.java,v 1.3 2004/12/25 16:26:24 jvanzyl
* Exp $
*/
public class GoalExecutionException
extends Exception
{
public GoalExecutionException( String message )
{
super( message );
}
public GoalExecutionException( Throwable cause )
{
super( cause );
}
public GoalExecutionException( String message, Throwable cause )
{
super( message, cause );
}
}
1.1 maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/GoalNotFoundException.java
Index: GoalNotFoundException.java
===================================================================
package org.apache.maven.lifecycle;
/*
* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
* License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
* or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
* ====================================================================
*/
public class GoalNotFoundException
extends GoalExecutionException
{
private String goalName;
public GoalNotFoundException( String goal )
{
super( "Unknown goal \"" + goal + "\"" );
this.goalName = goal;
}
public String getGoalName()
{
return this.goalName;
}
}
1.4 +100 -11 maven-components/maven-core/src/main/java/org/apache/maven/project/injection/DefaultModelDefaultsInjector.java
Index: DefaultModelDefaultsInjector.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/injection/DefaultModelDefaultsInjector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultModelDefaultsInjector.java 7 Mar 2005 08:15:25 -0000 1.3
+++ DefaultModelDefaultsInjector.java 7 Mar 2005 19:03:19 -0000 1.4
@@ -18,8 +18,12 @@
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Goal;
import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -36,11 +40,99 @@
public void injectDefaults( Model model )
{
injectDependencyDefaults( model.getDependencies(), model.getDependencyManagement() );
+ injectPluginDefaults( model.getPlugins(), model.getPluginManagement() );
+ }
+
+ private void injectPluginDefaults( List plugins, PluginManagement pluginManagement )
+ {
+ if ( pluginManagement != null )
+ {
+ // a given project's plugins should be smaller than the
+ // group-defined defaults set...
+ // in other words, the project's plugins will probably be a subset
+ // of
+ // those specified in defaults.
+ Map pluginMap = new TreeMap();
+ for ( Iterator it = plugins.iterator(); it.hasNext(); )
+ {
+ Plugin plugin = (Plugin) it.next();
+ pluginMap.put( plugin.getId(), plugin );
+ }
+
+ List managedPlugins = pluginManagement.getPlugins();
+
+ for ( Iterator it = managedPlugins.iterator(); it.hasNext(); )
+ {
+ Plugin def = (Plugin) it.next();
+ String key = def.getId();
+
+ Plugin plugin = (Plugin) pluginMap.get( key );
+ if ( plugin != null )
+ {
+ mergePluginWithDefaults( plugin, def );
+ }
+ }
+ }
+ }
+
+ private void mergePluginWithDefaults( Plugin plugin, Plugin def )
+ {
+ if ( plugin.getVersion() == null && def.getVersion() != null )
+ {
+ plugin.setVersion( def.getVersion() );
+ }
+
+ Boolean disabled = plugin.isDisabled();
+ if ( disabled == null )
+ {
+ plugin.setDisabled( def.isDisabled() );
+ }
+
+ Map goalMap = new TreeMap();
+
+ List pluginGoals = plugin.getGoals();
+ if ( pluginGoals != null )
+ {
+ for ( Iterator it = pluginGoals.iterator(); it.hasNext(); )
+ {
+ Goal goal = (Goal) it.next();
+
+ goalMap.put( goal.getId(), goal );
+ }
+ }
+
+ List defGoals = def.getGoals();
+ if ( defGoals != null )
+ {
+ for ( Iterator it = defGoals.iterator(); it.hasNext(); )
+ {
+ Goal defaultGoal = (Goal) it.next();
+
+ Goal localGoal = (Goal) goalMap.get( defaultGoal.getId() );
+ if ( localGoal == null )
+ {
+ goalMap.put( defaultGoal.getId(), defaultGoal );
+ }
+ else
+ {
+ Properties conf = defaultGoal.getConfiguration();
+
+ conf.putAll( localGoal.getConfiguration() );
+
+ localGoal.setConfiguration( conf );
+ }
+ }
+ }
+
+ plugin.setGoals( new ArrayList( goalMap.values() ) );
+
+ Properties props = new Properties( def.getConfiguration() );
+
+ props.putAll( plugin.getConfiguration() );
+
+ plugin.setConfiguration( props );
}
- /**
- * Added: Feb 1, 2005 by jdcasey
- */
private void injectDependencyDefaults( List dependencies, DependencyManagement dependencyManagement )
{
if ( dependencyManagement != null )
@@ -56,9 +148,9 @@
depsMap.put( dep.getManagementKey(), dep );
}
- List dependencyDefaults = dependencyManagement.getDependencies();
+ List managedDependencies = dependencyManagement.getDependencies();
- for ( Iterator it = dependencyDefaults.iterator(); it.hasNext(); )
+ for ( Iterator it = managedDependencies.iterator(); it.hasNext(); )
{
Dependency def = (Dependency) it.next();
String key = def.getManagementKey();
@@ -66,16 +158,13 @@
Dependency dep = (Dependency) depsMap.get( key );
if ( dep != null )
{
- mergeWithDefaults( dep, def );
+ mergeDependencyWithDefaults( dep, def );
}
}
}
}
- /**
- * Added: Feb 1, 2005 by jdcasey
- */
- private void mergeWithDefaults( Dependency dep, Dependency def )
+ private void mergeDependencyWithDefaults( Dependency dep, Dependency def )
{
if ( dep.getScope() == null && def.getScope() != null )
{
@@ -92,4 +181,4 @@
dep.setProperties( props );
}
-}
+}
\ No newline at end of file
1.10 +0 -27 maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssemblerTest.java
Index: DefaultModelInheritanceAssemblerTest.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssemblerTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DefaultModelInheritanceAssemblerTest.java 24 Feb 2005 04:15:47 -0000 1.9
+++ DefaultModelInheritanceAssemblerTest.java 7 Mar 2005 19:03:19 -0000 1.10
@@ -19,8 +19,6 @@
import junit.framework.TestCase;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
-import org.apache.maven.model.PostGoal;
-import org.apache.maven.model.PreGoal;
import org.apache.maven.model.Resource;
import org.apache.maven.model.Scm;
import org.apache.maven.model.UnitTest;
@@ -69,19 +67,6 @@
parentBuild.setUnitTest( parentUT );
parent.setBuild( parentBuild );
- PreGoal preGoal1 = new PreGoal();
- preGoal1.setName("compiler:compile");
- preGoal1.setAttain("clean:clean");
-
- parent.addPreGoal(preGoal1);
-
- // hehe...try getting anything done with this one in place!
- PostGoal postGoal1 = new PostGoal();
- postGoal1.setName("jar:jar");
- postGoal1.setAttain("clean:clean");
-
- parent.addPostGoal(postGoal1);
-
Model child = new Model();
child.setType( "plugin" );
@@ -95,12 +80,6 @@
childBuild.setUnitTest( childUT );
child.setBuild( childBuild );
- PreGoal preGoal2 = new PreGoal();
- preGoal2.setName("compiler:compile");
- preGoal2.setAttain("qdox:generate");
-
- child.addPreGoal(preGoal2);
-
assembler.assembleModelInheritance( child, parent );
assertEquals( "source directory should be from parent", "src/main/java", child.getBuild().getSourceDirectory() );
@@ -128,12 +107,6 @@
assertEquals( "plugin", child.getType() );
assertEquals( "jar", parent.getType() );
-
- assertEquals("merged child should have 2 preGoals", 2, child.getPreGoals().size());
- assertTrue("preGoal should be inherited from parent", child.getPreGoals().contains(preGoal1));
- assertTrue("preGoal should be preserved from child", child.getPreGoals().contains(preGoal2));
-
- assertEquals("1 postGoal should be inherited from parent", 1, child.getPostGoals().size());
}
/**
1.16 +3 -69 maven-components/maven-core/src/test/java/org/apache/maven/MavenTestCase.java
Index: MavenTestCase.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/MavenTestCase.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- MavenTestCase.java 4 Mar 2005 09:04:20 -0000 1.15
+++ MavenTestCase.java 7 Mar 2005 19:03:19 -0000 1.16
@@ -16,23 +16,14 @@
* limitations under the License.
*/
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
-import org.apache.maven.monitor.event.DefaultEventDispatcher;
-import org.apache.maven.monitor.logging.DefaultLog;
-import org.apache.maven.monitor.logging.Log;
-import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.execution.MavenSession;
-
import org.codehaus.plexus.ArtifactEnabledPlexusTestCase;
+import java.io.File;
+
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id$
@@ -86,61 +77,4 @@
return projectBuilder.build( pom, getLocalRepository() );
}
- // ----------------------------------------------------------------------
- // Execution context
- // ----------------------------------------------------------------------
-
- protected MavenGoalExecutionContext createGoalExecutionContext()
- throws Exception
- {
- return createGoalExecutionContext( null, null );
- }
-
- protected MavenGoalExecutionContext createGoalExecutionContext( File pom )
- throws Exception
- {
- return createGoalExecutionContext( pom, null );
- }
-
- protected MavenGoalExecutionContext createGoalExecutionContext( String goal )
- throws Exception
- {
- return createGoalExecutionContext( null, goal );
- }
-
- protected MavenGoalExecutionContext createGoalExecutionContext( File pom, String goal )
- throws Exception
- {
- MavenProject project;
-
- if ( pom != null )
- {
- project = getProject( pom );
- }
- else
- {
- File f = getTestFile( "target/test-classes/pom.xml" );
-
- project = getProject( f );
- }
-
- return createGoalExecutionContext( project, getLocalRepository(), goal );
- }
-
- protected MavenGoalExecutionContext createGoalExecutionContext( MavenProject project,
- ArtifactRepository localRepository,
- String goal )
- {
- List goals = new ArrayList();
-
- Log log = new DefaultLog(getContainer().getLogger());
-
- MavenSession session = new MavenSession( getContainer(), pluginManager, localRepository, new DefaultEventDispatcher(), log, goals );
-
- session.setProject( project );
-
- MavenGoalExecutionContext context = new MavenGoalExecutionContext( session, goal );
-
- return context;
- }
}
1.21 +15 -28 maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
Index: MavenProject.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProject.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- MavenProject.java 7 Mar 2005 09:41:55 -0000 1.20
+++ MavenProject.java 7 Mar 2005 19:03:19 -0000 1.21
@@ -39,15 +39,13 @@
import java.util.Set;
/**
- * The concern of the project is provide runtime values based on the model.
- * <p/>
- * The values in the model remain untouched but during the process of building
- * a project notions like inheritance and interpolation can be added. This allows
- * to have an entity which is useful in a runtime while preserving the model so that
- * it can be marshalled and unmarshalled without being tainted by runtime
- * requirements.
- * <p/>
- * We need to leave the model intact because we don't want the following:
+ * The concern of the project is provide runtime values based on the model. <p/>
+ * The values in the model remain untouched but during the process of building a
+ * project notions like inheritance and interpolation can be added. This allows
+ * to have an entity which is useful in a runtime while preserving the model so
+ * that it can be marshalled and unmarshalled without being tainted by runtime
+ * requirements. <p/>We need to leave the model intact because we don't want
+ * the following:
* <ol>
* <li>We don't want interpolated values being written back into the model.
* <li>We don't want inherited values being written back into the model.
@@ -67,6 +65,7 @@
{
this.model = model;
}
+
// ----------------------------------------------------------------------
// Accessors
// ----------------------------------------------------------------------
@@ -116,7 +115,7 @@
{
return model.getDependencies();
}
-
+
public DependencyManagement getDependencyManagement()
{
return model.getDependencyManagement();
@@ -126,7 +125,8 @@
// Test and compile sourceroots.
// ----------------------------------------------------------------------
- //!!! Refactor, collect the list of compile source roots and create a path1:path2
+ //!!! Refactor, collect the list of compile source roots and create a
+ // path1:path2
// type construct from the list instead of the other way around. jvz.
private String compileSourceRoots = "";
@@ -239,7 +239,8 @@
if ( isAddedToClasspath( a ) )
{
// TODO: let the scope handler deal with this
- if ( a.getScope() == null || "test".equals( a.getScope() ) || "compile".equals( a.getScope() ) || "runtime".equals( a.getScope() ) )
+ if ( a.getScope() == null || "test".equals( a.getScope() ) || "compile".equals( a.getScope() )
+ || "runtime".equals( a.getScope() ) )
{
list.add( a.getPath() );
}
@@ -327,7 +328,7 @@
public void setType( String type )
{
- model.setType( type );
+ model.setType( type );
}
public void setInceptionYear( String inceptionYear )
@@ -541,23 +542,9 @@
}
// ----------------------------------------------------------------------
- // Decorators
- // ----------------------------------------------------------------------
-
- public List getPreGoals()
- {
- return model.getPreGoals();
- }
-
- public List getPostGoals()
- {
- return model.getPostGoals();
- }
-
- // ----------------------------------------------------------------------
// Plugins
// ----------------------------------------------------------------------
-
+
public List getPlugins()
{
return model.getPlugins();
1.79 +38 -54 maven-components/maven-model/maven.mdo
Index: maven.mdo
===================================================================
RCS file: /home/cvs/maven-components/maven-model/maven.mdo,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- maven.mdo 7 Mar 2005 08:15:26 -0000 1.78
+++ maven.mdo 7 Mar 2005 19:03:19 -0000 1.79
@@ -407,6 +407,17 @@
<type>DependencyManagement</type>
</association>
</field>
+ <!-- [ jdcasey:06-Mar-2005 ] Added to handle version management, etc. for
+ | plugins to be used in sub-projects. -->
+ <field>
+ <name>pluginManagement</name>
+ <version>4.0.0</version>
+ <required>false</required>
+ <description><![CDATA[Default plugin information for grouped projects inheriting from this one.]]></description>
+ <association>
+ <type>PluginManagement</type>
+ </association>
+ </field>
<!-- @todo long run 4.0.0 may not need properties, with the parameters being specified
for the plugin directly -->
<field>
@@ -422,24 +433,6 @@
<multiplicity>*</multiplicity>
</association>
</field>
- <field>
- <name>preGoals</name>
- <version>4.0.0</version>
- <description><![CDATA[Set of decorator(s) injected before the target goal(s).]]></description>
- <association>
- <type>PreGoal</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- <field>
- <name>postGoals</name>
- <version>4.0.0</version>
- <description><![CDATA[Set of decorator(s) injected after the target goal(s).]]></description>
- <association>
- <type>PostGoal</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
<!-- @todo is this for javadoc only? maybe make it a plugin property? -->
<field xml.tagName="package">
<name>packageName</name>
@@ -1546,38 +1539,6 @@
</field>
</fields>
</class>
- <class>
- <name>GoalDecorator</name>
- <version>4.0.0</version>
- <fields>
- <field>
- <name>name</name>
- <version>4.0.0</version>
- <description><![CDATA[The target goal which should be decorated.]]></description>
- <type>String</type>
- </field>
- <field>
- <name>attain</name>
- <version>4.0.0</version>
- <description><![CDATA[
- The goal which should be injected into the execution chain.
- ]]></description>
- <type>String</type>
- </field>
- </fields>
- </class>
- <class>
- <superClass>GoalDecorator</superClass>
- <name>PreGoal</name>
- <version>4.0.0</version>
- <fields></fields>
- </class>
- <class>
- <superClass>GoalDecorator</superClass>
- <name>PostGoal</name>
- <version>4.0.0</version>
- <fields></fields>
- </class>
<!--
@@ -1631,8 +1592,8 @@
<field>
<name>disabled</name>
<version>4.0.0</version>
- <type>boolean</type>
- <defaultValue>false</defaultValue>
+ <type>Boolean</type>
+ <!-- defaultValue>false</defaultValue -->
</field>
<field>
<name>configuration</name>
@@ -1664,8 +1625,8 @@
<field>
<name>disabled</name>
<version>4.0.0</version>
- <type>boolean</type>
- <defaultValue>false</defaultValue>
+ <type>Boolean</type>
+ <!-- defaultValue>false</defaultValue -->
</field>
<field>
<name>configuration</name>
@@ -1700,6 +1661,29 @@
</field>
</fields>
</class>
+ <class>
+ <name>PluginManagement</name>
+ <version>4.0.0</version>
+ <description>
+ Section for management of default plugin information for use in a group of POMs.
+ </description>
+ <fields>
+ <field>
+ <name>plugins</name>
+ <version>4.0.0</version>
+ <description>
+ The dependencies specified here are not validated until they
+ are referenced in a POM within the group. This allows the
+ specification of a "standard" version for a particular
+ dependency.
+ </description>
+ <association>
+ <type>Plugin</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
</classes>
</model>
1.23 +36 -33 maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
Index: DefaultMaven.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DefaultMaven.java 4 Mar 2005 09:04:21 -0000 1.22
+++ DefaultMaven.java 7 Mar 2005 19:03:19 -0000 1.23
@@ -24,9 +24,8 @@
import org.apache.maven.execution.MavenProjectExecutionRequest;
import org.apache.maven.execution.MavenReactorExecutionRequest;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.GoalNotFoundException;
import org.apache.maven.lifecycle.LifecycleExecutor;
-import org.apache.maven.lifecycle.goal.GoalNotFoundException;
-import org.apache.maven.lifecycle.session.MavenSessionPhaseManager;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.PluginManager;
@@ -52,7 +51,7 @@
import java.util.List;
/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id$
*/
public class DefaultMaven
@@ -69,8 +68,6 @@
protected PluginManager pluginManager;
- protected MavenSessionPhaseManager sessionPhaseManager;
-
protected LifecycleExecutor lifecycleExecutor;
protected PlexusContainer container;
@@ -79,8 +76,7 @@
// Project execution
// ----------------------------------------------------------------------
- public MavenExecutionResponse execute( MavenExecutionRequest request )
- throws GoalNotFoundException, Exception
+ public MavenExecutionResponse execute( MavenExecutionRequest request ) throws GoalNotFoundException, Exception
{
// TODO: not happy about this:
if ( request instanceof MavenReactorExecutionRequest )
@@ -94,8 +90,7 @@
}
// TODO: don't throw generic exception
- public MavenExecutionResponse handleProject( MavenExecutionRequest request )
- throws Exception
+ public MavenExecutionResponse handleProject( MavenExecutionRequest request ) throws Exception
{
MavenSession session = createSession( request );
@@ -109,18 +104,18 @@
// Event monitoring.
EventDispatcher dispatcher = request.getEventDispatcher();
String event = MavenEvents.PROJECT_EXECUTION;
-
+
dispatcher.dispatchStart( event, project.getId() );
-
+
MavenExecutionResponse response = null;
try
{
// Actual meat of the code.
response = lifecycleExecutor.execute( request.getGoals(), session );
-
+
dispatcher.dispatchEnd( event, project.getId() );
}
- catch(Exception e)
+ catch ( Exception e )
{
dispatcher.dispatchError( event, project.getId(), e );
}
@@ -131,8 +126,10 @@
{
if ( response.getException() != null )
{
- // TODO: this should be a "FATAL" exception, reported to the developers - however currently a LOT of
- // "user" errors fall through the cracks (like invalid POMs, as one example)
+ // TODO: this should be a "FATAL" exception, reported to the
+ // developers - however currently a LOT of
+ // "user" errors fall through the cracks (like invalid POMs, as
+ // one example)
logError( response );
}
else
@@ -151,12 +148,11 @@
// Reactor
// ----------------------------------------------------------------------
- public MavenExecutionResponse handleReactor( MavenReactorExecutionRequest request )
- throws ReactorException
+ public MavenExecutionResponse handleReactor( MavenReactorExecutionRequest request ) throws ReactorException
{
EventDispatcher dispatcher = request.getEventDispatcher();
String event = MavenEvents.REACTOR_EXECUTION;
-
+
dispatcher.dispatchStart( event, request.getBaseDirectory().getPath() );
try
{
@@ -231,7 +227,7 @@
}
}
-
+
dispatcher.dispatchEnd( event, request.getBaseDirectory().getPath() );
// TODO: not really satisfactory
@@ -240,13 +236,12 @@
catch ( ReactorException e )
{
dispatcher.dispatchError( event, request.getBaseDirectory().getPath(), e );
-
+
throw e;
}
}
- public MavenProject getProject( File pom, ArtifactRepository localRepository )
- throws ProjectBuildingException
+ public MavenProject getProject( File pom, ArtifactRepository localRepository ) throws ProjectBuildingException
{
if ( pom.exists() )
{
@@ -263,20 +258,26 @@
// Methods used by all execution request handlers
// ----------------------------------------------------------------------
- //!! We should probably have the execution request handler create the session as
+ //!! We should probably have the execution request handler create the
+ // session as
// the session type would be specific to the request i.e. having a project
// or not.
protected MavenSession createSession( MavenExecutionRequest request )
{
- return new MavenSession( container, pluginManager, request.getLocalRepository(), request.getEventDispatcher(), request.getLog(), request.getGoals() );
+ return new MavenSession( container,
+ pluginManager,
+ request.getLocalRepository(),
+ request.getEventDispatcher(),
+ request.getLog(),
+ request.getGoals() );
}
/**
- * @todo [BP] this might not be required if there is a better way to pass them in. It doesn't feel quite right.
+ * @todo [BP] this might not be required if there is a better way to pass
+ * them in. It doesn't feel quite right.
*/
- private void resolveParameters( MavenExecutionRequest request )
- throws ComponentLookupException
+ private void resolveParameters( MavenExecutionRequest request ) throws ComponentLookupException
{
WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
@@ -295,7 +296,9 @@
getLogger().warn( "maven.proxy.http.port was not valid" );
}
}
- wagonManager.setProxy( "http", request.getParameter( "maven.proxy.http.host" ), port,
+ wagonManager.setProxy( "http",
+ request.getParameter( "maven.proxy.http.host" ),
+ port,
request.getParameter( "maven.proxy.http.username" ),
request.getParameter( "maven.proxy.http.password" ),
request.getParameter( "maven.proxy.http.nonProxyHosts" ) );
@@ -380,7 +383,8 @@
Runtime r = Runtime.getRuntime();
- getLogger().info( "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/" + ( r.totalMemory() / mb ) + "M" );
+ getLogger().info( "Final Memory: " + ((r.totalMemory() - r.freeMemory()) / mb) + "M/" + (r.totalMemory() / mb)
+ + "M" );
}
protected void line()
@@ -414,10 +418,9 @@
// Reactor
// ----------------------------------------------------------------------
- public List getSortedProjects( List projects )
- throws CycleDetectedException
+ public List getSortedProjects( List projects ) throws CycleDetectedException
{
return projectBuilder.getSortedProjects( projects );
}
-}
+}
\ No newline at end of file
1.12 +5 -6 maven-components/maven-core/src/main/java/org/apache/maven/Maven.java
Index: Maven.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/Maven.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Maven.java 20 Jan 2005 20:38:05 -0000 1.11
+++ Maven.java 7 Mar 2005 19:03:19 -0000 1.12
@@ -18,16 +18,15 @@
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResponse;
-import org.apache.maven.lifecycle.goal.GoalNotFoundException;
+import org.apache.maven.lifecycle.GoalNotFoundException;
/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id$
*/
public interface Maven
{
static String ROLE = Maven.class.getName();
- MavenExecutionResponse execute( MavenExecutionRequest request )
- throws GoalNotFoundException, Exception;
-}
+ MavenExecutionResponse execute( MavenExecutionRequest request ) throws GoalNotFoundException, Exception;
+}
\ No newline at end of file
1.18 +210 -137 maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
Index: DefaultModelInheritanceAssembler.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- DefaultModelInheritanceAssembler.java 24 Feb 2005 04:15:47 -0000 1.17
+++ DefaultModelInheritanceAssembler.java 7 Mar 2005 19:03:19 -0000 1.18
@@ -17,20 +17,22 @@
* ====================================================================
*/
+import org.apache.maven.model.Build;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Goal;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PostGoal;
-import org.apache.maven.model.PreGoal;
+import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Repository;
import org.apache.maven.model.Scm;
+import org.apache.maven.model.UnitTest;
import org.codehaus.plexus.util.StringUtils;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.TreeMap;
/**
@@ -127,40 +129,7 @@
}
// Scm
- if ( parent.getScm() != null )
- {
- Scm parentScm = parent.getScm();
-
- Scm childScm = child.getScm();
-
- if ( childScm == null )
- {
- childScm = new Scm();
-
- child.setScm( childScm );
- }
-
- if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) )
- {
- childScm.setConnection( parentScm.getConnection() + "/" + child.getArtifactId() );
- }
-
- if ( StringUtils.isEmpty( childScm.getDeveloperConnection() )
- && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
- {
- childScm.setDeveloperConnection( parentScm.getDeveloperConnection() + "/" + child.getArtifactId() );
- }
-
- if ( StringUtils.isEmpty( childScm.getUrl() ) )
- {
- childScm.setUrl( parentScm.getUrl() );
- }
-
- if ( parentScm.getBranches() != null )
- {
- childScm.getBranches().addAll( parentScm.getBranches() );
- }
- }
+ assembleScmInheritance( child, parent );
// ciManagement
if ( child.getCiManagement() == null )
@@ -193,75 +162,7 @@
}
// Build
- if ( child.getBuild() == null )
- {
- child.setBuild( parent.getBuild() );
- }
- else
- {
- // The build has been set but we want to step in here and fill in
- // values
- // that have not been set by the child.
-
- if ( child.getBuild().getDirectory() == null )
- {
- child.getBuild().setDirectory( parent.getBuild().getDirectory() );
- }
-
- if ( child.getBuild().getSourceDirectory() == null )
- {
- child.getBuild().setSourceDirectory( parent.getBuild().getSourceDirectory() );
- }
-
- if ( child.getBuild().getUnitTestSourceDirectory() == null )
- {
- child.getBuild().setUnitTestSourceDirectory( parent.getBuild().getUnitTestSourceDirectory() );
- }
-
- if ( child.getBuild().getOutput() == null )
- {
- child.getBuild().setOutput( parent.getBuild().getOutput() );
- }
-
- if ( child.getBuild().getTestOutput() == null )
- {
- child.getBuild().setTestOutput( parent.getBuild().getTestOutput() );
- }
-
- if ( child.getBuild().getFinalName() == null )
- {
- child.getBuild().setFinalName( parent.getBuild().getFinalName() );
- }
-
- List resources = child.getBuild().getResources();
- if ( resources == null || resources.isEmpty() )
- {
- child.getBuild().setResources( parent.getBuild().getResources() );
- }
-
- if ( child.getBuild().getUnitTest() == null )
- {
- child.getBuild().setUnitTest( parent.getBuild().getUnitTest() );
- }
- else
- {
- if ( child.getBuild().getUnitTest().getIncludes().size() == 0 )
- {
- child.getBuild().getUnitTest().setIncludes( parent.getBuild().getUnitTest().getIncludes() );
- }
-
- if ( child.getBuild().getUnitTest().getExcludes().size() == 0 )
- {
- child.getBuild().getUnitTest().setExcludes( parent.getBuild().getUnitTest().getExcludes() );
- }
-
- List testResources = child.getBuild().getUnitTest().getResources();
- if ( testResources == null || testResources.isEmpty() )
- {
- child.getBuild().getUnitTest().setResources( parent.getBuild().getUnitTest().getResources() );
- }
- }
- }
+ assembleBuildInheritance( child, parent );
// Dependencies :: aggregate
List dependencies = parent.getDependencies();
@@ -274,28 +175,6 @@
}
- // PreGoals :: aggregate
- List preGoals = parent.getPreGoals();
-
- for ( Iterator iterator = preGoals.iterator(); iterator.hasNext(); )
- {
- PreGoal preGoal = (PreGoal) iterator.next();
-
- child.addPreGoal( preGoal );
-
- }
-
- // PostGoals :: aggregate
- List postGoals = parent.getPostGoals();
-
- for ( Iterator iterator = postGoals.iterator(); iterator.hasNext(); )
- {
- PostGoal postGoal = (PostGoal) iterator.next();
-
- child.addPostGoal( postGoal );
-
- }
-
// Repositories :: aggregate
List parentRepositories = parent.getRepositories();
@@ -326,6 +205,85 @@
}
}
+ assembleDependencyManagementInheritance( child, parent );
+
+ assemblePluginManagementInheritance( child, parent );
+
+ }
+
+ private void assemblePluginManagementInheritance( Model child, Model parent )
+ {
+ PluginManagement parentPluginMgmt = parent.getPluginManagement();
+
+ PluginManagement childPluginMgmt = child.getPluginManagement();
+
+ if ( parentPluginMgmt != null )
+ {
+ if ( childPluginMgmt == null )
+ {
+ child.setPluginManagement( parentPluginMgmt );
+ }
+ else
+ {
+ List childPlugins = childPluginMgmt.getPlugins();
+
+ Map mappedChildPlugins = new TreeMap();
+ for ( Iterator it = childPlugins.iterator(); it.hasNext(); )
+ {
+ Plugin plugin = (Plugin) it.next();
+ mappedChildPlugins.put( plugin.getId(), plugin );
+ }
+
+ for ( Iterator it = parentPluginMgmt.getPlugins().iterator(); it.hasNext(); )
+ {
+ Plugin plugin = (Plugin) it.next();
+ if ( !mappedChildPlugins.containsKey( plugin.getId() ) )
+ {
+ childPluginMgmt.addPlugin( plugin );
+ }
+ else
+ {
+ Plugin childPlugin = (Plugin) mappedChildPlugins.get( plugin.getId() );
+
+ Map mappedChildGoals = new TreeMap();
+ for ( Iterator itGoals = childPlugin.getGoals().iterator(); itGoals.hasNext(); )
+ {
+ Goal goal = (Goal) itGoals.next();
+ mappedChildGoals.put( goal.getId(), goal );
+ }
+
+ for ( Iterator itGoals = plugin.getGoals().iterator(); itGoals.hasNext(); )
+ {
+ Goal parentGoal = (Goal) itGoals.next();
+ Goal childGoal = (Goal) mappedChildGoals.get( parentGoal.getId() );
+
+ if ( childGoal == null )
+ {
+ childPlugin.addGoal( parentGoal );
+ }
+ else
+ {
+ Boolean disabled = childGoal.isDisabled();
+ if ( disabled == null )
+ {
+ childGoal.setDisabled( parentGoal.isDisabled() );
+
+ Properties conf = new Properties( childGoal.getConfiguration() );
+
+ conf.putAll( parentGoal.getConfiguration() );
+
+ childGoal.setConfiguration( conf );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void assembleDependencyManagementInheritance( Model child, Model parent )
+ {
DependencyManagement parentDepMgmt = parent.getDependencyManagement();
DependencyManagement childDepMgmt = child.getDependencyManagement();
@@ -338,27 +296,142 @@
}
else
{
- List parentDeps = parentDepMgmt.getDependencies();
+ List childDeps = childDepMgmt.getDependencies();
- Map mappedParentDeps = new TreeMap();
- for ( Iterator it = parentDeps.iterator(); it.hasNext(); )
+ Map mappedChildDeps = new TreeMap();
+ for ( Iterator it = childDeps.iterator(); it.hasNext(); )
{
Dependency dep = (Dependency) it.next();
- mappedParentDeps.put( dep.getManagementKey(), dep );
+ mappedChildDeps.put( dep.getManagementKey(), dep );
}
- List deps = new ArrayList( parentDeps );
- for ( Iterator it = childDepMgmt.getDependencies().iterator(); it.hasNext(); )
+ for ( Iterator it = parentDepMgmt.getDependencies().iterator(); it.hasNext(); )
{
Dependency dep = (Dependency) it.next();
- if ( !mappedParentDeps.containsKey( dep.getManagementKey() ) )
+ if ( !mappedChildDeps.containsKey( dep.getManagementKey() ) )
{
- deps.add( dep );
+ childDepMgmt.addDependency( dep );
}
}
+ }
+ }
+ }
+
+ private void assembleBuildInheritance( Model child, Model parent )
+ {
+ Build childBuild = child.getBuild();
+ Build parentBuild = parent.getBuild();
+
+ if ( childBuild == null )
+ {
+ child.setBuild( parentBuild );
+ }
+ else
+ {
+ // The build has been set but we want to step in here and fill in
+ // values
+ // that have not been set by the child.
+
+ if ( childBuild.getDirectory() == null )
+ {
+ childBuild.setDirectory( parentBuild.getDirectory() );
+ }
+
+ if ( childBuild.getSourceDirectory() == null )
+ {
+ childBuild.setSourceDirectory( parentBuild.getSourceDirectory() );
+ }
+
+ if ( childBuild.getUnitTestSourceDirectory() == null )
+ {
+ childBuild.setUnitTestSourceDirectory( parentBuild.getUnitTestSourceDirectory() );
+ }
+
+ if ( childBuild.getOutput() == null )
+ {
+ childBuild.setOutput( parentBuild.getOutput() );
+ }
- childDepMgmt.setDependencies( deps );
+ if ( childBuild.getTestOutput() == null )
+ {
+ childBuild.setTestOutput( parentBuild.getTestOutput() );
+ }
+
+ if ( childBuild.getFinalName() == null )
+ {
+ childBuild.setFinalName( parentBuild.getFinalName() );
+ }
+
+ List resources = childBuild.getResources();
+ if ( resources == null || resources.isEmpty() )
+ {
+ childBuild.setResources( parentBuild.getResources() );
+ }
+
+ UnitTest childUnitTest = childBuild.getUnitTest();
+ UnitTest parentUnitTest = parentBuild.getUnitTest();
+
+ if ( childUnitTest == null )
+ {
+ childBuild.setUnitTest( parentUnitTest );
+ }
+ else
+ {
+ if ( childUnitTest.getIncludes().size() == 0 )
+ {
+ childUnitTest.setIncludes( parentUnitTest.getIncludes() );
+ }
+
+ if ( childUnitTest.getExcludes().size() == 0 )
+ {
+ childUnitTest.setExcludes( parentUnitTest.getExcludes() );
+ }
+
+ List testResources = childUnitTest.getResources();
+ if ( testResources == null || testResources.isEmpty() )
+ {
+ childUnitTest.setResources( parentUnitTest.getResources() );
+ }
}
}
}
+
+ private void assembleScmInheritance( Model child, Model parent )
+ {
+ if ( parent.getScm() != null )
+ {
+ Scm parentScm = parent.getScm();
+
+ Scm childScm = child.getScm();
+
+ if ( childScm == null )
+ {
+ childScm = new Scm();
+
+ child.setScm( childScm );
+ }
+
+ if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) )
+ {
+ childScm.setConnection( parentScm.getConnection() + "/" + child.getArtifactId() );
+ }
+
+ if ( StringUtils.isEmpty( childScm.getDeveloperConnection() )
+ && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
+ {
+ childScm.setDeveloperConnection( parentScm.getDeveloperConnection() + "/" + child.getArtifactId() );
+ }
+
+ if ( StringUtils.isEmpty( childScm.getUrl() ) )
+ {
+ childScm.setUrl( parentScm.getUrl() );
+ }
+
+ if ( parentScm.getBranches() != null )
+ {
+ childScm.getBranches().addAll( parentScm.getBranches() );
+ }
+ }
+ }
+
}
\ No newline at end of file
1.3 +9 -10 maven-components/maven-core/src/main/java/org/apache/maven/util/introspection/ReflectionValueExtractor.java
Index: ReflectionValueExtractor.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/introspection/ReflectionValueExtractor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ReflectionValueExtractor.java 1 Mar 2005 07:05:33 -0000 1.2
+++ ReflectionValueExtractor.java 7 Mar 2005 19:03:19 -0000 1.3
@@ -27,11 +27,11 @@
/**
* Using simple dotted expressions extract the values from a MavenProject
* instance, For example we might want to extract a value like:
- *
* project.build.sourceDirectory
- *
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
+ *
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
+ * @version $Id: ReflectionValueExtractor.java,v 1.2 2005/03/01 07:05:33 brett
+ * Exp $
*/
public class ReflectionValueExtractor
{
@@ -48,8 +48,7 @@
}
// TODO: don't throw Exception
- public static Object evaluate( String expression, Object root )
- throws Exception
+ public static Object evaluate( String expression, Object root ) throws Exception
{
// ----------------------------------------------------------------------
// Remove the leading "project" token
@@ -66,12 +65,12 @@
StringTokenizer parser = new StringTokenizer( expression, "." );
- while( parser.hasMoreTokens() )
+ while ( parser.hasMoreTokens() )
{
- classMap = getClassMap( value.getClass() );
-
String token = parser.nextToken();
+ classMap = getClassMap( value.getClass() );
+
String methodName = "get" + StringUtils.capitalizeFirstLetter( token );
Method method = classMap.findMethod( methodName, args );
@@ -86,7 +85,7 @@
{
classMap = (ClassMap) classMaps.get( clazz );
- if( classMap == null )
+ if ( classMap == null )
{
classMap = new ClassMap( clazz );
}