mirror of https://github.com/apache/maven.git
o Moved the default plugin stuff to <pluginManagement/>. Plugin config will be pulled from here and injected into <plugins/> as needed to satisfy type-handlers at runtime.
o Added the ability for DefaultMaven to load only the super-pom in the event that no pom.xml exists to initiate the assembly. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc95065bb7
commit
f6c2684903
|
@ -97,7 +97,17 @@ public class DefaultMaven
|
||||||
{
|
{
|
||||||
MavenSession session = createSession( request );
|
MavenSession session = createSession( request );
|
||||||
|
|
||||||
MavenProject project = getProject( (File) request.getProjectFiles().get( 0 ), request.getLocalRepository() );
|
List projectFiles = request.getProjectFiles();
|
||||||
|
|
||||||
|
MavenProject project = null;
|
||||||
|
if(projectFiles != null && !projectFiles.isEmpty())
|
||||||
|
{
|
||||||
|
project = getProject( (File) request.getProjectFiles().get( 0 ), request.getLocalRepository() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
project = projectBuilder.buildSuperProject( request.getLocalRepository() );
|
||||||
|
}
|
||||||
|
|
||||||
session.setProject( project );
|
session.setProject( project );
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.model.user.UserModel;
|
import org.apache.maven.model.user.UserModel;
|
||||||
import org.apache.maven.monitor.event.EventDispatcher;
|
import org.apache.maven.monitor.event.EventDispatcher;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +40,6 @@ extends AbstractMavenExecutionRequest
|
||||||
|
|
||||||
public List getProjectFiles()
|
public List getProjectFiles()
|
||||||
{
|
{
|
||||||
return null;
|
return Collections.EMPTY_LIST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||||
import org.apache.maven.execution.MavenExecutionResponse;
|
import org.apache.maven.execution.MavenExecutionResponse;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
|
import org.apache.maven.model.PluginManagement;
|
||||||
import org.apache.maven.monitor.event.EventDispatcher;
|
import org.apache.maven.monitor.event.EventDispatcher;
|
||||||
import org.apache.maven.monitor.event.MavenEvents;
|
import org.apache.maven.monitor.event.MavenEvents;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
|
@ -81,9 +82,11 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
MavenProject project = session.getProject();
|
||||||
|
|
||||||
// TODO: should enrich this with the type handler, but for now just
|
// TODO: should enrich this with the type handler, but for now just
|
||||||
// use "type" as is
|
// use "type" as is
|
||||||
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( session.getProject().getPackaging() );
|
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( project.getPackaging() );
|
||||||
|
|
||||||
if ( handler != null )
|
if ( handler != null )
|
||||||
{
|
{
|
||||||
|
@ -96,6 +99,11 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
if ( handler.additionalPlugin() != null )
|
if ( handler.additionalPlugin() != null )
|
||||||
{
|
{
|
||||||
|
String additionalPluginGroupId = "maven";
|
||||||
|
String additionalPluginArtifactId = "maven-" + handler.additionalPlugin() + "-plugin";
|
||||||
|
|
||||||
|
injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId );
|
||||||
|
|
||||||
processPluginPhases( "maven", "maven-" + handler.additionalPlugin() + "-plugin", session );
|
processPluginPhases( "maven", "maven-" + handler.additionalPlugin() + "-plugin", session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,6 +147,31 @@ public class DefaultLifecycleExecutor
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void injectHandlerPluginConfiguration( MavenProject project, String groupId, String artifactId )
|
||||||
|
{
|
||||||
|
PluginManagement mgmt = project.getPluginManagement();
|
||||||
|
if( mgmt != null )
|
||||||
|
{
|
||||||
|
List pluginList = mgmt.getPlugins();
|
||||||
|
|
||||||
|
Plugin handlerPlugin = null;
|
||||||
|
for ( Iterator it = pluginList.iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
Plugin plugin = (Plugin) it.next();
|
||||||
|
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
|
||||||
|
{
|
||||||
|
handlerPlugin = plugin;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( handlerPlugin != null )
|
||||||
|
{
|
||||||
|
project.addPlugin( handlerPlugin );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: don't throw Exception
|
// TODO: don't throw Exception
|
||||||
private void processPluginConfiguration( MavenProject project, MavenSession mavenSession )
|
private void processPluginConfiguration( MavenProject project, MavenSession mavenSession )
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.maven.model.Repository;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
|
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
|
||||||
import org.apache.maven.project.injection.ModelDefaultsInjector;
|
import org.apache.maven.project.injection.ModelDefaultsInjector;
|
||||||
|
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
||||||
import org.apache.maven.project.interpolation.ModelInterpolator;
|
import org.apache.maven.project.interpolation.ModelInterpolator;
|
||||||
import org.apache.maven.project.path.PathTranslator;
|
import org.apache.maven.project.path.PathTranslator;
|
||||||
import org.apache.maven.project.validation.ModelValidationResult;
|
import org.apache.maven.project.validation.ModelValidationResult;
|
||||||
|
@ -118,57 +119,11 @@ public class DefaultMavenProjectBuilder
|
||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
Model model = modelInterpolator.interpolate( project.getModel() );
|
project = processProjectLogic( project, localRepository, resolveDependencies );
|
||||||
|
|
||||||
// interpolation is before injection, because interpolation is off-limits in the injected variables
|
|
||||||
modelDefaultsInjector.injectDefaults( model );
|
|
||||||
|
|
||||||
MavenProject parentProject = project.getParent();
|
|
||||||
|
|
||||||
project = new MavenProject( model );
|
|
||||||
project.setFile( projectDescriptor );
|
|
||||||
project.setParent( parentProject );
|
|
||||||
project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(), localRepository, null ) );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Typically when the project builder is being used from maven proper
|
|
||||||
// the transitive dependencies will not be resolved here because this
|
|
||||||
// requires a lot of work when we may only be interested in running
|
|
||||||
// something simple like 'm2 clean'. So the artifact collector is used
|
|
||||||
// in the dependency resolution phase if it is required by any of the
|
|
||||||
// goals being executed. But when used as a component in another piece
|
|
||||||
// of code people may just want to build maven projects and have the
|
|
||||||
// dependencies resolved for whatever reason: this is why we keep
|
|
||||||
// this snippet of code here.
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
if ( resolveDependencies )
|
|
||||||
{
|
|
||||||
List repos = buildArtifactRepositories( project.getRepositories() );
|
|
||||||
|
|
||||||
MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver, this );
|
|
||||||
|
|
||||||
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(), repos,
|
|
||||||
localRepository, sourceReader );
|
|
||||||
|
|
||||||
project.getArtifacts().addAll( result.getArtifacts().values() );
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelValidationResult validationResult = validator.validate( project.getModel() );
|
|
||||||
|
|
||||||
if ( validationResult.getMessageCount() > 0 )
|
|
||||||
{
|
|
||||||
throw new ProjectBuildingException( "Exception while building project: " + validationResult.toString() );
|
|
||||||
}
|
|
||||||
|
|
||||||
project.setFile( projectDescriptor );
|
project.setFile( projectDescriptor );
|
||||||
|
|
||||||
pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor );
|
pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor );
|
||||||
|
|
||||||
project.addCompileSourceRoot( project.getBuild().getSourceDirectory() );
|
|
||||||
project.addScriptSourceRoot( project.getBuild().getScriptSourceDirectory() );
|
|
||||||
project.addTestCompileSourceRoot( project.getBuild().getTestSourceDirectory() );
|
|
||||||
|
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
|
@ -177,8 +132,61 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MavenProject processProjectLogic( MavenProject project, ArtifactRepository localRepository,
|
||||||
|
boolean resolveDependencies )
|
||||||
|
throws ProjectBuildingException, ModelInterpolationException, ArtifactResolutionException
|
||||||
|
{
|
||||||
|
Model model = modelInterpolator.interpolate( project.getModel() );
|
||||||
|
|
||||||
|
// interpolation is before injection, because interpolation is off-limits in the injected variables
|
||||||
|
modelDefaultsInjector.injectDefaults( model );
|
||||||
|
|
||||||
|
MavenProject parentProject = project.getParent();
|
||||||
|
|
||||||
|
project = new MavenProject( model );
|
||||||
|
project.setParent( parentProject );
|
||||||
|
project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(), localRepository, null ) );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Typically when the project builder is being used from maven proper
|
||||||
|
// the transitive dependencies will not be resolved here because this
|
||||||
|
// requires a lot of work when we may only be interested in running
|
||||||
|
// something simple like 'm2 clean'. So the artifact collector is used
|
||||||
|
// in the dependency resolution phase if it is required by any of the
|
||||||
|
// goals being executed. But when used as a component in another piece
|
||||||
|
// of code people may just want to build maven projects and have the
|
||||||
|
// dependencies resolved for whatever reason: this is why we keep
|
||||||
|
// this snippet of code here.
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
if ( resolveDependencies )
|
||||||
|
{
|
||||||
|
List repos = buildArtifactRepositories( project.getRepositories() );
|
||||||
|
|
||||||
|
MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver, this );
|
||||||
|
|
||||||
|
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(), repos,
|
||||||
|
localRepository, sourceReader );
|
||||||
|
|
||||||
|
project.getArtifacts().addAll( result.getArtifacts().values() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelValidationResult validationResult = validator.validate( project.getModel() );
|
||||||
|
|
||||||
|
if ( validationResult.getMessageCount() > 0 )
|
||||||
|
{
|
||||||
|
throw new ProjectBuildingException( "Exception while building project: " + validationResult.toString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
project.addCompileSourceRoot( project.getBuild().getSourceDirectory() );
|
||||||
|
project.addScriptSourceRoot( project.getBuild().getScriptSourceDirectory() );
|
||||||
|
project.addTestCompileSourceRoot( project.getBuild().getTestSourceDirectory() );
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
private MavenProject assembleLineage( File projectDescriptor, ArtifactRepository localRepository,
|
private MavenProject assembleLineage( File projectDescriptor, ArtifactRepository localRepository,
|
||||||
LinkedList lineage, List aggregatedRemoteWagonRepositories )
|
LinkedList lineage, List aggregatedRemoteWagonRepositories )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Model model = readModel( projectDescriptor );
|
Model model = readModel( projectDescriptor );
|
||||||
|
@ -245,8 +253,7 @@ public class DefaultMavenProjectBuilder
|
||||||
return repos;
|
return repos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model readModel( File file )
|
private Model readModel( File file ) throws ProjectBuildingException
|
||||||
throws ProjectBuildingException
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -259,12 +266,12 @@ public class DefaultMavenProjectBuilder
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException(
|
throw new ProjectBuildingException(
|
||||||
"Error while reading model from file '" + file.getAbsolutePath() + "'.", e );
|
"Error while reading model from file '" + file.getAbsolutePath() + "'.",
|
||||||
|
e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model readModel( URL url )
|
private Model readModel( URL url ) throws ProjectBuildingException
|
||||||
throws ProjectBuildingException
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -293,8 +300,8 @@ public class DefaultMavenProjectBuilder
|
||||||
catch ( ArtifactResolutionException e )
|
catch ( ArtifactResolutionException e )
|
||||||
{
|
{
|
||||||
// @todo use parent.toString() if modello could generate it, or specify in a code segment
|
// @todo use parent.toString() if modello could generate it, or specify in a code segment
|
||||||
throw new ProjectBuildingException( "Missing parent POM: " + parent.getGroupId() + ":" +
|
throw new ProjectBuildingException( "Missing parent POM: " + parent.getGroupId() + ":"
|
||||||
parent.getArtifactId() + "-" + parent.getVersion(), e );
|
+ parent.getArtifactId() + "-" + parent.getVersion(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
return artifact.getFile();
|
return artifact.getFile();
|
||||||
|
@ -311,8 +318,7 @@ public class DefaultMavenProjectBuilder
|
||||||
* <li>do a topo sort on the graph that remains.</li>
|
* <li>do a topo sort on the graph that remains.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public List getSortedProjects( List projects )
|
public List getSortedProjects( List projects ) throws CycleDetectedException
|
||||||
throws CycleDetectedException
|
|
||||||
{
|
{
|
||||||
DAG dag = new DAG();
|
DAG dag = new DAG();
|
||||||
|
|
||||||
|
@ -360,15 +366,45 @@ public class DefaultMavenProjectBuilder
|
||||||
return sortedProjects;
|
return sortedProjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MavenProject buildSuperProject( ArtifactRepository localRepository )
|
||||||
|
throws ProjectBuildingException
|
||||||
|
{
|
||||||
|
return buildSuperProject( localRepository, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
public MavenProject buildSuperProject( ArtifactRepository localRepository, boolean resolveDependencies )
|
||||||
|
throws ProjectBuildingException
|
||||||
|
{
|
||||||
|
MavenProject project = new MavenProject( getSuperModel() );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
project = processProjectLogic( project, localRepository, resolveDependencies );
|
||||||
|
|
||||||
|
File projectFile = new File( ".", "pom.xml" );
|
||||||
|
project.setFile( projectFile );
|
||||||
|
pathTranslator.alignToBaseDirectory( project.getModel(), projectFile );
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
catch ( ModelInterpolationException e )
|
||||||
|
{
|
||||||
|
throw new ProjectBuildingException( "Error building super-project", e );
|
||||||
|
}
|
||||||
|
catch ( ArtifactResolutionException e )
|
||||||
|
{
|
||||||
|
throw new ProjectBuildingException( "Error building super-project", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
private Model getSuperModel()
|
private Model getSuperModel() throws ProjectBuildingException
|
||||||
throws ProjectBuildingException
|
|
||||||
{
|
{
|
||||||
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MavenConstants.MAVEN_MODEL_VERSION + ".xml" );
|
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MavenConstants.MAVEN_MODEL_VERSION + ".xml" );
|
||||||
|
|
||||||
return readModel( url );
|
return readModel( url );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,6 +29,8 @@ import org.apache.maven.model.License;
|
||||||
import org.apache.maven.model.MailingList;
|
import org.apache.maven.model.MailingList;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Organization;
|
import org.apache.maven.model.Organization;
|
||||||
|
import org.apache.maven.model.Plugin;
|
||||||
|
import org.apache.maven.model.PluginManagement;
|
||||||
import org.apache.maven.model.Reports;
|
import org.apache.maven.model.Reports;
|
||||||
import org.apache.maven.model.Scm;
|
import org.apache.maven.model.Scm;
|
||||||
|
|
||||||
|
@ -522,5 +524,32 @@ public class MavenProject
|
||||||
}
|
}
|
||||||
return model.getBuild().getPlugins();
|
return model.getBuild().getPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PluginManagement getPluginManagement()
|
||||||
|
{
|
||||||
|
PluginManagement pluginMgmt = null;
|
||||||
|
|
||||||
|
Build build = model.getBuild();
|
||||||
|
if ( build != null )
|
||||||
|
{
|
||||||
|
pluginMgmt = build.getPluginManagement();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pluginMgmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPlugin( Plugin plugin )
|
||||||
|
{
|
||||||
|
Build build = model.getBuild();
|
||||||
|
|
||||||
|
if ( build == null )
|
||||||
|
{
|
||||||
|
build = new Build();
|
||||||
|
|
||||||
|
model.setBuild( build );
|
||||||
|
}
|
||||||
|
|
||||||
|
build.addPlugin( plugin );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,12 @@ public interface MavenProjectBuilder
|
||||||
MavenProject build( File project, ArtifactRepository localRepository, boolean transitive )
|
MavenProject build( File project, ArtifactRepository localRepository, boolean transitive )
|
||||||
throws ProjectBuildingException;
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
|
MavenProject buildSuperProject( ArtifactRepository localRepository )
|
||||||
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
|
MavenProject buildSuperProject( ArtifactRepository localRepository, boolean transitive )
|
||||||
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
// take this out
|
// take this out
|
||||||
|
|
||||||
List getSortedProjects( List projects )
|
List getSortedProjects( List projects )
|
||||||
|
|
|
@ -219,66 +219,83 @@ public class DefaultModelInheritanceAssembler
|
||||||
|
|
||||||
private void assemblePluginManagementInheritance( Model child, Model parent )
|
private void assemblePluginManagementInheritance( Model child, Model parent )
|
||||||
{
|
{
|
||||||
PluginManagement parentPluginMgmt = parent.getPluginManagement();
|
Build parentBuild = parent.getBuild();
|
||||||
|
Build childBuild = parent.getBuild();
|
||||||
|
|
||||||
PluginManagement childPluginMgmt = child.getPluginManagement();
|
if ( childBuild == null )
|
||||||
|
|
||||||
if ( parentPluginMgmt != null )
|
|
||||||
{
|
{
|
||||||
if ( childPluginMgmt == null )
|
if ( parentBuild != null )
|
||||||
{
|
{
|
||||||
child.setPluginManagement( parentPluginMgmt );
|
child.setBuild( parentBuild );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List childPlugins = childPluginMgmt.getPlugins();
|
childBuild = new Build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PluginManagement parentPluginMgmt = parentBuild.getPluginManagement();
|
||||||
|
|
||||||
Map mappedChildPlugins = new TreeMap();
|
PluginManagement childPluginMgmt = childBuild.getPluginManagement();
|
||||||
for ( Iterator it = childPlugins.iterator(); it.hasNext(); )
|
|
||||||
|
if ( parentPluginMgmt != null )
|
||||||
|
{
|
||||||
|
if ( childPluginMgmt == null )
|
||||||
{
|
{
|
||||||
Plugin plugin = (Plugin) it.next();
|
childBuild.setPluginManagement( parentPluginMgmt );
|
||||||
mappedChildPlugins.put( constructPluginKey( plugin ), plugin );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
for ( Iterator it = parentPluginMgmt.getPlugins().iterator(); it.hasNext(); )
|
|
||||||
{
|
{
|
||||||
Plugin plugin = (Plugin) it.next();
|
List childPlugins = childPluginMgmt.getPlugins();
|
||||||
if ( !mappedChildPlugins.containsKey( constructPluginKey( plugin ) ) )
|
|
||||||
|
Map mappedChildPlugins = new TreeMap();
|
||||||
|
for ( Iterator it = childPlugins.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
childPluginMgmt.addPlugin( plugin );
|
Plugin plugin = (Plugin) it.next();
|
||||||
|
mappedChildPlugins.put( constructPluginKey( plugin ), plugin );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for ( Iterator it = parentPluginMgmt.getPlugins().iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
Plugin childPlugin = (Plugin) mappedChildPlugins.get( constructPluginKey( plugin ) );
|
Plugin plugin = (Plugin) it.next();
|
||||||
|
if ( !mappedChildPlugins.containsKey( constructPluginKey( plugin ) ) )
|
||||||
Map mappedChildGoals = new TreeMap();
|
|
||||||
for ( Iterator itGoals = childPlugin.getGoals().iterator(); itGoals.hasNext(); )
|
|
||||||
{
|
{
|
||||||
Goal goal = (Goal) itGoals.next();
|
childPluginMgmt.addPlugin( plugin );
|
||||||
mappedChildGoals.put( goal.getId(), goal );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
for ( Iterator itGoals = plugin.getGoals().iterator(); itGoals.hasNext(); )
|
|
||||||
{
|
{
|
||||||
Goal parentGoal = (Goal) itGoals.next();
|
Plugin childPlugin = (Plugin) mappedChildPlugins.get( constructPluginKey( plugin ) );
|
||||||
Goal childGoal = (Goal) mappedChildGoals.get( parentGoal.getId() );
|
|
||||||
|
|
||||||
if ( childGoal == null )
|
Map mappedChildGoals = new TreeMap();
|
||||||
|
for ( Iterator itGoals = childPlugin.getGoals().iterator(); itGoals.hasNext(); )
|
||||||
{
|
{
|
||||||
childPlugin.addGoal( parentGoal );
|
Goal goal = (Goal) itGoals.next();
|
||||||
|
mappedChildGoals.put( goal.getId(), goal );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for ( Iterator itGoals = plugin.getGoals().iterator(); itGoals.hasNext(); )
|
||||||
{
|
{
|
||||||
Boolean disabled = childGoal.isDisabled();
|
Goal parentGoal = (Goal) itGoals.next();
|
||||||
if ( disabled == null )
|
Goal childGoal = (Goal) mappedChildGoals.get( parentGoal.getId() );
|
||||||
|
|
||||||
|
if ( childGoal == null )
|
||||||
{
|
{
|
||||||
childGoal.setDisabled( parentGoal.isDisabled() );
|
childPlugin.addGoal( parentGoal );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Boolean disabled = childGoal.isDisabled();
|
||||||
|
if ( disabled == null )
|
||||||
|
{
|
||||||
|
childGoal.setDisabled( parentGoal.isDisabled() );
|
||||||
|
|
||||||
Properties conf = new Properties( childGoal.getConfiguration() );
|
Properties conf = new Properties( childGoal.getConfiguration() );
|
||||||
|
|
||||||
conf.putAll( parentGoal.getConfiguration() );
|
conf.putAll( parentGoal.getConfiguration() );
|
||||||
|
|
||||||
childGoal.setConfiguration( conf );
|
childGoal.setConfiguration( conf );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DefaultModelDefaultsInjector
|
||||||
injectDependencyDefaults( model.getDependencies(), model.getDependencyManagement() );
|
injectDependencyDefaults( model.getDependencies(), model.getDependencyManagement() );
|
||||||
if ( model.getBuild() != null )
|
if ( model.getBuild() != null )
|
||||||
{
|
{
|
||||||
injectPluginDefaults( model.getBuild().getPlugins(), model.getPluginManagement() );
|
injectPluginDefaults( model.getBuild().getPlugins(), model.getBuild().getPluginManagement() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,53 +30,55 @@
|
||||||
</testResource>
|
</testResource>
|
||||||
</testResources>
|
</testResources>
|
||||||
<!-- Default plugins -->
|
<!-- Default plugins -->
|
||||||
<plugins>
|
<pluginManagement>
|
||||||
<plugin>
|
<plugins>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-pom-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-pom-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>maven</groupId>
|
<plugin>
|
||||||
<artifactId>maven-plugin-plugin</artifactId>
|
<groupId>maven</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</plugins>
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
|
@ -413,17 +413,6 @@
|
||||||
<type>DependencyManagement</type>
|
<type>DependencyManagement</type>
|
||||||
</association>
|
</association>
|
||||||
</field>
|
</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>
|
|
||||||
<field>
|
<field>
|
||||||
<name>properties</name>
|
<name>properties</name>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
|
@ -682,6 +671,17 @@
|
||||||
<multiplicity>*</multiplicity>
|
<multiplicity>*</multiplicity>
|
||||||
</association>
|
</association>
|
||||||
</field>
|
</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>
|
||||||
</fields>
|
</fields>
|
||||||
</class>
|
</class>
|
||||||
<class>
|
<class>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-modello-plugin</artifactId>
|
<artifactId>maven-modello-plugin</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<version>4.0.0</version>
|
<version>4.0.0</version>
|
||||||
<model>maven.mdo</model>
|
<model>maven.mdo</model>
|
||||||
|
@ -23,4 +24,4 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</model>
|
</model>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-modello-plugin</artifactId>
|
<artifactId>maven-modello-plugin</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<version>4.0.0</version>
|
<version>4.0.0</version>
|
||||||
<model>maven-user.mdo</model>
|
<model>maven-user.mdo</model>
|
||||||
|
@ -19,4 +20,4 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</model>
|
</model>
|
||||||
|
|
Loading…
Reference in New Issue