Resolving: MNG-878, MNG-921

o Verified that plugins are added to the list in the model when invoked from the command line (878)
o Reformatted ModelUtils after the profiles-cloning addition
o Added cache-flush for the plugin map in MavenProject
o Moved dependencies for subproject/subproject2 into the parent-project POM, inside a profile
o Added activation property for this new profile into the test.sh script
o Added explicit activation inside of release:perform's m2 invocation for all profile-ids active in the release-plugin's execution.
o Added code to remove the dynamic parts of the POM from the release-pom.xml...it's not meant to be a dynamic version of a POM.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290336 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-09-20 02:59:44 +00:00
parent 74de0709de
commit ec8d262f16
8 changed files with 295 additions and 270 deletions

View File

@ -53,9 +53,8 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.codehaus.modello</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>modello-maven-plugin</artifactId>
<version>2.0-beta-1</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@ -64,9 +63,40 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-project-info-reports-plugin</artifactId> <artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.0-alpha-1</version> <version>2.0-beta-1</version>
</plugin> </plugin>
</plugins> </plugins>
</reporting> </reporting>
<profiles>
<profile>
<id>env-test</id>
<activation>
<property>
<name>env</name>
<value>test</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<directory>alt-target</directory>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -8,19 +8,4 @@
<artifactId>project-sub1</artifactId> <artifactId>project-sub1</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project> </project>

View File

@ -14,30 +14,6 @@
<artifactId>project-sub1</artifactId> <artifactId>project-sub1</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>env-test</id>
<activation>
<property>
<name>env</name>
<value>test</value>
</property>
</activation>
</profile>
</profiles>
</project> </project>

View File

@ -18,11 +18,7 @@ cd project.checkout
rm -Rf target rm -Rf target
#. ~/shell-switches/m2-debug-on m2 -e release:prepare -Denv=test
#echo "Enabling debugging options. Please attach the debugger."
export MAVEN_OPTS= m2 -e release:perform -Denv=test
m2 -e release:prepare
m2 -e release:perform

View File

@ -16,9 +16,11 @@ package org.apache.maven.plugins.release;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.model.Profile;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.release.helpers.ReleaseProgressTracker; import org.apache.maven.plugins.release.helpers.ReleaseProgressTracker;
import org.apache.maven.plugins.release.helpers.ScmHelper; import org.apache.maven.plugins.release.helpers.ScmHelper;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.cli.CommandLineException; import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils; import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline; import org.codehaus.plexus.util.cli.Commandline;
@ -26,6 +28,8 @@ import org.codehaus.plexus.util.cli.DefaultConsumer;
import org.codehaus.plexus.util.cli.StreamConsumer; import org.codehaus.plexus.util.cli.StreamConsumer;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator;
import java.util.List;
/** /**
* Perform a release from SCM * Perform a release from SCM
@ -55,7 +59,14 @@ public class PerformReleaseMojo
* @required * @required
*/ */
protected String workingDirectory; protected String workingDirectory;
/**
* @parameter expression="${project}"
* @required
* @readonly
*/
protected MavenProject project;
private ReleaseProgressTracker releaseProgress; private ReleaseProgressTracker releaseProgress;
protected void executeTask() protected void executeTask()
@ -104,6 +115,26 @@ public class PerformReleaseMojo
cl.createArgument().setLine( "--batch-mode" ); cl.createArgument().setLine( "--batch-mode" );
List profiles = project.getActiveProfiles();
if ( profiles != null && !profiles.isEmpty() )
{
StringBuffer buffer = new StringBuffer();
buffer.append( "-P " );
for ( Iterator it = profiles.iterator(); it.hasNext(); )
{
Profile profile = (Profile) it.next();
buffer.append( profile.getId() ).append( "," );
}
buffer.setLength( buffer.length() - 1 );
cl.createArgument().setLine( buffer.toString() );
}
StreamConsumer consumer = new DefaultConsumer(); StreamConsumer consumer = new DefaultConsumer();
try try

View File

@ -836,6 +836,12 @@ public class PrepareReleaseMojo
Model releaseModel = releaseProject.getModel(); Model releaseModel = releaseProject.getModel();
fixNullValueInModel( releaseModel, project.getModel() ); fixNullValueInModel( releaseModel, project.getModel() );
// the release POM should reflect bits of these which were injected at build time...
// we don't need these polluting the POM.
releaseModel.setProfiles( Collections.EMPTY_LIST );
releaseModel.setDependencyManagement( null );
releaseModel.getBuild().setPluginManagement( null );
String projectVersion = releaseModel.getVersion(); String projectVersion = releaseModel.getVersion();
if ( ArtifactUtils.isSnapshot( projectVersion ) ) if ( ArtifactUtils.isSnapshot( projectVersion ) )
{ {

View File

@ -1129,6 +1129,7 @@ public class MavenProject
if ( !build.getPluginsAsMap().containsKey( plugin.getKey() ) ) if ( !build.getPluginsAsMap().containsKey( plugin.getKey() ) )
{ {
build.addPlugin( plugin ); build.addPlugin( plugin );
build.flushPluginMap();
} }
} }

View File

@ -19,7 +19,6 @@ package org.apache.maven.project;
import org.apache.maven.model.Activation; import org.apache.maven.model.Activation;
import org.apache.maven.model.ActivationFile; import org.apache.maven.model.ActivationFile;
import org.apache.maven.model.ActivationProperty; import org.apache.maven.model.ActivationProperty;
import org.apache.maven.model.Build;
import org.apache.maven.model.BuildBase; import org.apache.maven.model.BuildBase;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.DependencyManagement;
@ -56,7 +55,7 @@ import java.util.TreeMap;
public final class ModelUtils public final class ModelUtils
{ {
public static void mergePluginLists( PluginContainer childContainer, PluginContainer parentContainer, public static void mergePluginLists( PluginContainer childContainer, PluginContainer parentContainer,
boolean handleAsInheritance ) boolean handleAsInheritance )
{ {
if ( childContainer == null || parentContainer == null ) if ( childContainer == null || parentContainer == null )
{ {
@ -78,8 +77,8 @@ public final class ModelUtils
String parentInherited = parentPlugin.getInherited(); String parentInherited = parentPlugin.getInherited();
if ( !handleAsInheritance || parentInherited == null || if ( !handleAsInheritance || parentInherited == null
Boolean.valueOf( parentInherited ).booleanValue() ) || Boolean.valueOf( parentInherited ).booleanValue() )
{ {
Plugin assembledPlugin = parentPlugin; Plugin assembledPlugin = parentPlugin;
@ -140,8 +139,8 @@ public final class ModelUtils
String parentInherited = parentPlugin.getInherited(); String parentInherited = parentPlugin.getInherited();
if ( !handleAsInheritance || parentInherited == null || if ( !handleAsInheritance || parentInherited == null
Boolean.valueOf( parentInherited ).booleanValue() ) || Boolean.valueOf( parentInherited ).booleanValue() )
{ {
ReportPlugin assembledPlugin = parentPlugin; ReportPlugin assembledPlugin = parentPlugin;
@ -259,7 +258,7 @@ public final class ModelUtils
} }
public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent, public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent,
boolean handleAsInheritance ) boolean handleAsInheritance )
{ {
if ( child == null || parent == null ) if ( child == null || parent == null )
{ {
@ -486,9 +485,9 @@ public final class ModelUtils
newModel.setGroupId( model.getGroupId() ); newModel.setGroupId( model.getGroupId() );
newModel.setPackaging( model.getPackaging() ); newModel.setPackaging( model.getPackaging() );
newModel.setModules( cloneModules( model.getModules() ) ); newModel.setModules( cloneModules( model.getModules() ) );
newModel.setProfiles( cloneProfiles( model.getProfiles() ) ); newModel.setProfiles( cloneProfiles( model.getProfiles() ) );
assembler.copyModel( newModel, model ); assembler.copyModel( newModel, model );
return newModel; return newModel;
@ -500,103 +499,104 @@ public final class ModelUtils
{ {
return profiles; return profiles;
} }
List newProfiles = new ArrayList( profiles.size() ); List newProfiles = new ArrayList( profiles.size() );
for ( Iterator it = profiles.iterator(); it.hasNext(); ) for ( Iterator it = profiles.iterator(); it.hasNext(); )
{ {
Profile profile = (Profile) it.next(); Profile profile = (Profile) it.next();
Profile newProfile = new Profile(); Profile newProfile = new Profile();
newProfile.setId(profile.getId()); newProfile.setId( profile.getId() );
newProfile.setActivation( cloneProfileActivation( profile.getActivation() ) ); newProfile.setActivation( cloneProfileActivation( profile.getActivation() ) );
newProfile.setBuild( cloneProfileBuild( profile.getBuild() ) ); newProfile.setBuild( cloneProfileBuild( profile.getBuild() ) );
newProfile.setDependencies( cloneProfileDependencies( profile.getDependencies() ) ); newProfile.setDependencies( cloneProfileDependencies( profile.getDependencies() ) );
DependencyManagement dm = profile.getDependencyManagement(); DependencyManagement dm = profile.getDependencyManagement();
if ( dm != null ) if ( dm != null )
{ {
DependencyManagement newDM = new DependencyManagement(); DependencyManagement newDM = new DependencyManagement();
newDM.setDependencies( cloneProfileDependencies( dm.getDependencies() ) ); newDM.setDependencies( cloneProfileDependencies( dm.getDependencies() ) );
newProfile.setDependencyManagement( newDM ); newProfile.setDependencyManagement( newDM );
} }
newProfile.setDistributionManagement( cloneProfileDistributionManagement( profile.getDistributionManagement() ) ); newProfile.setDistributionManagement( cloneProfileDistributionManagement( profile
.getDistributionManagement() ) );
List modules = profile.getModules(); List modules = profile.getModules();
if ( modules != null && !modules.isEmpty() ) if ( modules != null && !modules.isEmpty() )
{ {
newProfile.setModules( new ArrayList( modules ) ); newProfile.setModules( new ArrayList( modules ) );
} }
newProfile.setPluginRepositories( cloneProfileRepositories( profile.getPluginRepositories() ) ); newProfile.setPluginRepositories( cloneProfileRepositories( profile.getPluginRepositories() ) );
Properties props = profile.getProperties(); Properties props = profile.getProperties();
if ( props != null ) if ( props != null )
{ {
newProfile.setProperties( new Properties( props ) ); newProfile.setProperties( new Properties( props ) );
} }
newProfile.setReporting( cloneProfileReporting( profile.getReporting() ) ); newProfile.setReporting( cloneProfileReporting( profile.getReporting() ) );
newProfile.setReports( profile.getReports() ); newProfile.setReports( profile.getReports() );
newProfile.setRepositories( cloneProfileRepositories( profile.getRepositories() ) ); newProfile.setRepositories( cloneProfileRepositories( profile.getRepositories() ) );
newProfile.setSource(profile.getSource() ); newProfile.setSource( profile.getSource() );
newProfiles.add( newProfile ); newProfiles.add( newProfile );
} }
return newProfiles; return newProfiles;
} }
private static Reporting cloneProfileReporting( Reporting reporting ) private static Reporting cloneProfileReporting( Reporting reporting )
{ {
Reporting newR = null; Reporting newR = null;
if ( reporting != null ) if ( reporting != null )
{ {
newR = new Reporting(); newR = new Reporting();
newR.setOutputDirectory(reporting.getOutputDirectory()); newR.setOutputDirectory( reporting.getOutputDirectory() );
List newP = null; List newP = null;
List plugins = reporting.getPlugins(); List plugins = reporting.getPlugins();
if ( plugins != null ) if ( plugins != null )
{ {
newP = new ArrayList( plugins.size() ); newP = new ArrayList( plugins.size() );
for ( Iterator it = plugins.iterator(); it.hasNext(); ) for ( Iterator it = plugins.iterator(); it.hasNext(); )
{ {
ReportPlugin plugin = (ReportPlugin) it.next(); ReportPlugin plugin = (ReportPlugin) it.next();
ReportPlugin newPlugin = new ReportPlugin(); ReportPlugin newPlugin = new ReportPlugin();
newPlugin.setArtifactId(plugin.getArtifactId()); newPlugin.setArtifactId( plugin.getArtifactId() );
newPlugin.setGroupId(plugin.getGroupId()); newPlugin.setGroupId( plugin.getGroupId() );
newPlugin.setVersion(plugin.getVersion()); newPlugin.setVersion( plugin.getVersion() );
newPlugin.setInherited(plugin.getInherited()); newPlugin.setInherited( plugin.getInherited() );
newPlugin.setReportSets( cloneReportSets( plugin.getReportSets() ) ); newPlugin.setReportSets( cloneReportSets( plugin.getReportSets() ) );
// TODO: Implement deep-copy of configuration. // TODO: Implement deep-copy of configuration.
newPlugin.setConfiguration(plugin.getConfiguration()); newPlugin.setConfiguration( plugin.getConfiguration() );
newP.add( newPlugin ); newP.add( newPlugin );
} }
newR.setPlugins(newP); newR.setPlugins( newP );
} }
} }
@ -606,178 +606,178 @@ public final class ModelUtils
private static List cloneReportSets( List sets ) private static List cloneReportSets( List sets )
{ {
List newSets = null; List newSets = null;
if ( sets != null ) if ( sets != null )
{ {
newSets = new ArrayList( sets.size() ); newSets = new ArrayList( sets.size() );
for ( Iterator it = sets.iterator(); it.hasNext(); ) for ( Iterator it = sets.iterator(); it.hasNext(); )
{ {
ReportSet set = (ReportSet) it.next(); ReportSet set = (ReportSet) it.next();
ReportSet newSet = new ReportSet(); ReportSet newSet = new ReportSet();
// TODO: Deep-copy config. // TODO: Deep-copy config.
newSet.setConfiguration(set.getConfiguration()); newSet.setConfiguration( set.getConfiguration() );
newSet.setId(set.getId()); newSet.setId( set.getId() );
newSet.setInherited(set.getInherited()); newSet.setInherited( set.getInherited() );
newSet.setReports(new ArrayList( set.getReports() )); newSet.setReports( new ArrayList( set.getReports() ) );
newSets.add( newSet ); newSets.add( newSet );
} }
} }
return newSets; return newSets;
} }
private static List cloneProfileRepositories( List repos ) private static List cloneProfileRepositories( List repos )
{ {
List newRepos = null; List newRepos = null;
if ( repos != null ) if ( repos != null )
{ {
newRepos = new ArrayList( repos.size() ); newRepos = new ArrayList( repos.size() );
for ( Iterator it = repos.iterator(); it.hasNext(); ) for ( Iterator it = repos.iterator(); it.hasNext(); )
{ {
Repository repo = (Repository) it.next(); Repository repo = (Repository) it.next();
Repository newRepo = new Repository(); Repository newRepo = new Repository();
newRepo.setChecksumPolicy(repo.getChecksumPolicy()); newRepo.setChecksumPolicy( repo.getChecksumPolicy() );
newRepo.setId(repo.getId()); newRepo.setId( repo.getId() );
newRepo.setLayout(repo.getLayout()); newRepo.setLayout( repo.getLayout() );
newRepo.setName(repo.getName()); newRepo.setName( repo.getName() );
newRepo.setSnapshotPolicy(repo.getSnapshotPolicy()); newRepo.setSnapshotPolicy( repo.getSnapshotPolicy() );
RepositoryPolicy releasePolicy = repo.getReleases(); RepositoryPolicy releasePolicy = repo.getReleases();
if ( releasePolicy != null ) if ( releasePolicy != null )
{ {
RepositoryPolicy newPolicy = new RepositoryPolicy(); RepositoryPolicy newPolicy = new RepositoryPolicy();
newPolicy.setEnabled(releasePolicy.isEnabled()); newPolicy.setEnabled( releasePolicy.isEnabled() );
newPolicy.setChecksumPolicy(releasePolicy.getChecksumPolicy()); newPolicy.setChecksumPolicy( releasePolicy.getChecksumPolicy() );
newPolicy.setUpdatePolicy(releasePolicy.getUpdatePolicy()); newPolicy.setUpdatePolicy( releasePolicy.getUpdatePolicy() );
newRepo.setReleases(newPolicy); newRepo.setReleases( newPolicy );
} }
RepositoryPolicy snapPolicy = repo.getSnapshots(); RepositoryPolicy snapPolicy = repo.getSnapshots();
if ( snapPolicy != null ) if ( snapPolicy != null )
{ {
RepositoryPolicy newPolicy = new RepositoryPolicy(); RepositoryPolicy newPolicy = new RepositoryPolicy();
newPolicy.setEnabled(snapPolicy.isEnabled()); newPolicy.setEnabled( snapPolicy.isEnabled() );
newPolicy.setChecksumPolicy(snapPolicy.getChecksumPolicy()); newPolicy.setChecksumPolicy( snapPolicy.getChecksumPolicy() );
newPolicy.setUpdatePolicy(snapPolicy.getUpdatePolicy()); newPolicy.setUpdatePolicy( snapPolicy.getUpdatePolicy() );
newRepo.setSnapshots(newPolicy); newRepo.setSnapshots( newPolicy );
} }
newRepo.setUrl(repo.getUrl()); newRepo.setUrl( repo.getUrl() );
newRepos.add( newRepo ); newRepos.add( newRepo );
} }
} }
return newRepos; return newRepos;
} }
private static DistributionManagement cloneProfileDistributionManagement( DistributionManagement dm ) private static DistributionManagement cloneProfileDistributionManagement( DistributionManagement dm )
{ {
DistributionManagement newDM = null; DistributionManagement newDM = null;
if ( dm != null ) if ( dm != null )
{ {
newDM = new DistributionManagement(); newDM = new DistributionManagement();
newDM.setDownloadUrl(dm.getDownloadUrl() ); newDM.setDownloadUrl( dm.getDownloadUrl() );
newDM.setStatus(dm.getStatus()); newDM.setStatus( dm.getStatus() );
Relocation relocation = dm.getRelocation(); Relocation relocation = dm.getRelocation();
if ( relocation != null ) if ( relocation != null )
{ {
Relocation newR = new Relocation(); Relocation newR = new Relocation();
newR.setArtifactId(relocation.getArtifactId()); newR.setArtifactId( relocation.getArtifactId() );
newR.setGroupId(relocation.getGroupId()); newR.setGroupId( relocation.getGroupId() );
newR.setMessage(relocation.getMessage()); newR.setMessage( relocation.getMessage() );
newR.setVersion(relocation.getVersion()); newR.setVersion( relocation.getVersion() );
newDM.setRelocation(newR); newDM.setRelocation( newR );
} }
RepositoryBase repo = dm.getRepository(); RepositoryBase repo = dm.getRepository();
if ( repo != null ) if ( repo != null )
{ {
RepositoryBase newRepo = new RepositoryBase(); RepositoryBase newRepo = new RepositoryBase();
newRepo.setId(repo.getId()); newRepo.setId( repo.getId() );
newRepo.setLayout(repo.getLayout()); newRepo.setLayout( repo.getLayout() );
newRepo.setName(repo.getName()); newRepo.setName( repo.getName() );
newRepo.setUrl(repo.getUrl()); newRepo.setUrl( repo.getUrl() );
newDM.setRepository(newRepo); newDM.setRepository( newRepo );
} }
Site site = dm.getSite(); Site site = dm.getSite();
if ( site != null ) if ( site != null )
{ {
Site newSite = new Site(); Site newSite = new Site();
newSite.setId(site.getId()); newSite.setId( site.getId() );
newSite.setName(site.getName()); newSite.setName( site.getName() );
newSite.setUrl(site.getUrl()); newSite.setUrl( site.getUrl() );
newDM.setSite(newSite); newDM.setSite( newSite );
} }
RepositoryBase sRepo = dm.getSnapshotRepository(); RepositoryBase sRepo = dm.getSnapshotRepository();
if ( sRepo != null ) if ( sRepo != null )
{ {
RepositoryBase newRepo = new RepositoryBase(); RepositoryBase newRepo = new RepositoryBase();
newRepo.setId(sRepo.getId()); newRepo.setId( sRepo.getId() );
newRepo.setLayout(sRepo.getLayout()); newRepo.setLayout( sRepo.getLayout() );
newRepo.setName(sRepo.getName()); newRepo.setName( sRepo.getName() );
newRepo.setUrl(sRepo.getUrl()); newRepo.setUrl( sRepo.getUrl() );
newDM.setSnapshotRepository(newRepo); newDM.setSnapshotRepository( newRepo );
} }
} }
return newDM; return newDM;
} }
private static List cloneProfileDependencies( List dependencies ) private static List cloneProfileDependencies( List dependencies )
{ {
List newDependencies = null; List newDependencies = null;
if ( dependencies != null ) if ( dependencies != null )
{ {
newDependencies = new ArrayList( dependencies.size() ); newDependencies = new ArrayList( dependencies.size() );
for ( Iterator it = dependencies.iterator(); it.hasNext(); ) for ( Iterator it = dependencies.iterator(); it.hasNext(); )
{ {
Dependency dep = (Dependency) it.next(); Dependency dep = (Dependency) it.next();
Dependency newDep = new Dependency(); Dependency newDep = new Dependency();
newDep.setArtifactId(dep.getArtifactId()); newDep.setArtifactId( dep.getArtifactId() );
newDep.setClassifier(dep.getClassifier()); newDep.setClassifier( dep.getClassifier() );
newDep.setExclusions( cloneDependencyExclusions( dep.getExclusions() ) ); newDep.setExclusions( cloneDependencyExclusions( dep.getExclusions() ) );
newDep.setGroupId(dep.getGroupId()); newDep.setGroupId( dep.getGroupId() );
newDep.setScope(dep.getScope()); newDep.setScope( dep.getScope() );
newDep.setSystemPath(dep.getSystemPath()); newDep.setSystemPath( dep.getSystemPath() );
newDep.setType(dep.getType()); newDep.setType( dep.getType() );
newDep.setVersion(dep.getVersion()); newDep.setVersion( dep.getVersion() );
newDependencies.add( newDep ); newDependencies.add( newDep );
} }
} }
@ -788,20 +788,20 @@ public final class ModelUtils
private static List cloneDependencyExclusions( List ex ) private static List cloneDependencyExclusions( List ex )
{ {
List newEx = null; List newEx = null;
if ( ex != null ) if ( ex != null )
{ {
newEx = new ArrayList( ex.size() ); newEx = new ArrayList( ex.size() );
for ( Iterator it = ex.iterator(); it.hasNext(); ) for ( Iterator it = ex.iterator(); it.hasNext(); )
{ {
Exclusion exclusion = (Exclusion) it.next(); Exclusion exclusion = (Exclusion) it.next();
Exclusion newExclusion = new Exclusion(); Exclusion newExclusion = new Exclusion();
newExclusion.setArtifactId(exclusion.getArtifactId() ); newExclusion.setArtifactId( exclusion.getArtifactId() );
newExclusion.setGroupId( exclusion.getGroupId() ); newExclusion.setGroupId( exclusion.getGroupId() );
newEx.add( newExclusion ); newEx.add( newExclusion );
} }
} }
@ -815,135 +815,135 @@ public final class ModelUtils
if ( build != null ) if ( build != null )
{ {
newBuild = new BuildBase(); newBuild = new BuildBase();
newBuild.setDefaultGoal(build.getDefaultGoal()); newBuild.setDefaultGoal( build.getDefaultGoal() );
newBuild.setDirectory(build.getDirectory()); newBuild.setDirectory( build.getDirectory() );
newBuild.setFinalName(build.getFinalName()); newBuild.setFinalName( build.getFinalName() );
newBuild.setPluginManagement( cloneProfilePluginManagement( build.getPluginManagement() ) ); newBuild.setPluginManagement( cloneProfilePluginManagement( build.getPluginManagement() ) );
newBuild.setPlugins( cloneProfilePlugins( build.getPlugins() ) ); newBuild.setPlugins( cloneProfilePlugins( build.getPlugins() ) );
newBuild.setResources( cloneProfileResources( build.getResources() ) ); newBuild.setResources( cloneProfileResources( build.getResources() ) );
newBuild.setTestResources( cloneProfileResources( build.getTestResources() ) ); newBuild.setTestResources( cloneProfileResources( build.getTestResources() ) );
} }
return newBuild; return newBuild;
} }
private static List cloneProfileResources( List resources ) private static List cloneProfileResources( List resources )
{ {
List newResources = null; List newResources = null;
if ( resources != null ) if ( resources != null )
{ {
newResources = new ArrayList( resources.size() ); newResources = new ArrayList( resources.size() );
for ( Iterator it = resources.iterator(); it.hasNext(); ) for ( Iterator it = resources.iterator(); it.hasNext(); )
{ {
Resource resource = (Resource) it.next(); Resource resource = (Resource) it.next();
Resource newResource = new Resource(); Resource newResource = new Resource();
newResource.setDirectory(resource.getDirectory()); newResource.setDirectory( resource.getDirectory() );
newResource.setExcludes(new ArrayList( resource.getExcludes())); newResource.setExcludes( new ArrayList( resource.getExcludes() ) );
newResource.setFiltering(resource.isFiltering()); newResource.setFiltering( resource.isFiltering() );
newResource.setIncludes(new ArrayList( resource.getIncludes())); newResource.setIncludes( new ArrayList( resource.getIncludes() ) );
newResource.setTargetPath(resource.getTargetPath()); newResource.setTargetPath( resource.getTargetPath() );
newResources.add( newResource ); newResources.add( newResource );
} }
} }
return newResources; return newResources;
} }
private static PluginManagement cloneProfilePluginManagement( PluginManagement pluginManagement ) private static PluginManagement cloneProfilePluginManagement( PluginManagement pluginManagement )
{ {
PluginManagement newPM = null; PluginManagement newPM = null;
if ( pluginManagement != null ) if ( pluginManagement != null )
{ {
newPM = new PluginManagement(); newPM = new PluginManagement();
List plugins = pluginManagement.getPlugins(); List plugins = pluginManagement.getPlugins();
newPM.setPlugins( cloneProfilePlugins( plugins ) ); newPM.setPlugins( cloneProfilePlugins( plugins ) );
} }
return newPM; return newPM;
} }
private static List cloneProfilePlugins( List plugins ) private static List cloneProfilePlugins( List plugins )
{ {
List newPlugins = null; List newPlugins = null;
if ( plugins != null ) if ( plugins != null )
{ {
newPlugins = new ArrayList( plugins.size() ); newPlugins = new ArrayList( plugins.size() );
for ( Iterator it = plugins.iterator(); it.hasNext(); ) for ( Iterator it = plugins.iterator(); it.hasNext(); )
{ {
Plugin plugin = (Plugin) it.next(); Plugin plugin = (Plugin) it.next();
Plugin newPlugin = new Plugin(); Plugin newPlugin = new Plugin();
newPlugin.setArtifactId(plugin.getArtifactId()); newPlugin.setArtifactId( plugin.getArtifactId() );
newPlugin.setExtensions(plugin.isExtensions()); newPlugin.setExtensions( plugin.isExtensions() );
newPlugin.setGroupId(plugin.getGroupId()); newPlugin.setGroupId( plugin.getGroupId() );
newPlugin.setInherited(plugin.getInherited()); newPlugin.setInherited( plugin.getInherited() );
newPlugin.setVersion(plugin.getVersion()); newPlugin.setVersion( plugin.getVersion() );
// TODO: Deep-copy this! // TODO: Deep-copy this!
newPlugin.setConfiguration(plugin.getConfiguration()); newPlugin.setConfiguration( plugin.getConfiguration() );
List goals = plugin.getGoals(); List goals = plugin.getGoals();
if ( goals != null && !goals.isEmpty() ) if ( goals != null && !goals.isEmpty() )
{ {
List newGoals = new ArrayList( goals ); List newGoals = new ArrayList( goals );
newPlugin.setGoals(newGoals); newPlugin.setGoals( newGoals );
} }
newPlugin.setExecutions( cloneExecutions( plugin.getExecutions() )); newPlugin.setExecutions( cloneExecutions( plugin.getExecutions() ) );
newPlugins.add( newPlugin ); newPlugins.add( newPlugin );
} }
} }
return newPlugins; return newPlugins;
} }
private static List cloneExecutions( List executions ) private static List cloneExecutions( List executions )
{ {
List newExecs = null; List newExecs = null;
if ( executions != null ) if ( executions != null )
{ {
newExecs = new ArrayList( executions.size() ); newExecs = new ArrayList( executions.size() );
for ( Iterator it = executions.iterator(); it.hasNext(); ) for ( Iterator it = executions.iterator(); it.hasNext(); )
{ {
PluginExecution exec = (PluginExecution) it.next(); PluginExecution exec = (PluginExecution) it.next();
PluginExecution newExec = new PluginExecution(); PluginExecution newExec = new PluginExecution();
// TODO: Deep-copy configs. // TODO: Deep-copy configs.
newExec.setConfiguration(exec.getConfiguration()); newExec.setConfiguration( exec.getConfiguration() );
newExec.setId(exec.getId()); newExec.setId( exec.getId() );
newExec.setInherited(exec.getInherited()); newExec.setInherited( exec.getInherited() );
newExec.setPhase(exec.getPhase()); newExec.setPhase( exec.getPhase() );
List goals = exec.getGoals(); List goals = exec.getGoals();
if ( goals != null && !goals.isEmpty() ) if ( goals != null && !goals.isEmpty() )
{ {
newExec.setGoals( new ArrayList( goals ) ); newExec.setGoals( new ArrayList( goals ) );
} }
newExecs.add( newExec ); newExecs.add( newExec );
} }
} }
return newExecs; return newExecs;
} }
@ -953,35 +953,35 @@ public final class ModelUtils
if ( activation != null ) if ( activation != null )
{ {
newActivation = new Activation(); newActivation = new Activation();
newActivation.setActiveByDefault(activation.isActiveByDefault()); newActivation.setActiveByDefault( activation.isActiveByDefault() );
ActivationFile af = activation.getFile(); ActivationFile af = activation.getFile();
if ( af != null ) if ( af != null )
{ {
ActivationFile afNew = new ActivationFile(); ActivationFile afNew = new ActivationFile();
afNew.setExists(af.getExists()); afNew.setExists( af.getExists() );
afNew.setMissing(af.getMissing()); afNew.setMissing( af.getMissing() );
newActivation.setFile(afNew); newActivation.setFile( afNew );
} }
newActivation.setJdk(activation.getJdk()); newActivation.setJdk( activation.getJdk() );
ActivationProperty ap = activation.getProperty(); ActivationProperty ap = activation.getProperty();
if ( ap != null ) if ( ap != null )
{ {
ActivationProperty newAp = new ActivationProperty(); ActivationProperty newAp = new ActivationProperty();
newAp.setName(ap.getName()); newAp.setName( ap.getName() );
newAp.setValue(ap.getValue()); newAp.setValue( ap.getValue() );
newActivation.setProperty(newAp); newActivation.setProperty( newAp );
} }
} }
return newActivation; return newActivation;
} }