o Generified model/project

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@744572 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-02-14 21:49:23 +00:00
parent fda7685244
commit fac6b97faf
3 changed files with 169 additions and 164 deletions

View File

@ -743,7 +743,7 @@
<version>4.0.0</version> <version>4.0.0</version>
<code> <code>
<![CDATA[ <![CDATA[
java.util.Map pluginMap; java.util.Map<String, Plugin> pluginMap;
/** /**
* Reset the <code>pluginsMap</code> field to <code>null</code> * Reset the <code>pluginsMap</code> field to <code>null</code>
@ -757,14 +757,14 @@
* @return a Map of plugins field with <code>Plugins#getKey()</code> as key * @return a Map of plugins field with <code>Plugins#getKey()</code> as key
* @see org.apache.maven.model.Plugin#getKey() * @see org.apache.maven.model.Plugin#getKey()
*/ */
public synchronized java.util.Map getPluginsAsMap() public synchronized java.util.Map<String, Plugin> getPluginsAsMap()
{ {
if ( pluginMap == null ) if ( pluginMap == null )
{ {
pluginMap = new java.util.LinkedHashMap(); pluginMap = new java.util.LinkedHashMap<String, Plugin>();
if ( plugins != null ) if ( plugins != null )
{ {
for ( java.util.Iterator it = plugins.iterator(); it.hasNext(); ) for ( java.util.Iterator<Plugin> it = plugins.iterator(); it.hasNext(); )
{ {
Plugin plugin = (Plugin) it.next(); Plugin plugin = (Plugin) it.next();
pluginMap.put( plugin.getKey(), plugin ); pluginMap.put( plugin.getKey(), plugin );
@ -2621,7 +2621,7 @@
<version>4.0.0</version> <version>4.0.0</version>
<code> <code>
<![CDATA[ <![CDATA[
private java.util.Map executionMap = null; private java.util.Map<String, PluginExecution> executionMap = null;
/** /**
* Reset the <code>executionMap</code> field to <code>null</code> * Reset the <code>executionMap</code> field to <code>null</code>
@ -2635,14 +2635,14 @@
* @return a Map of executions field with <code>PluginExecution#getId()</code> as key * @return a Map of executions field with <code>PluginExecution#getId()</code> as key
* @see org.apache.maven.model.PluginExecution#getId() * @see org.apache.maven.model.PluginExecution#getId()
*/ */
public java.util.Map getExecutionsAsMap() public java.util.Map<String, PluginExecution> getExecutionsAsMap()
{ {
if ( executionMap == null ) if ( executionMap == null )
{ {
executionMap = new java.util.LinkedHashMap(); executionMap = new java.util.LinkedHashMap<String, PluginExecution>();
if ( getExecutions() != null ) if ( getExecutions() != null )
{ {
for ( java.util.Iterator i = getExecutions().iterator(); i.hasNext(); ) for ( java.util.Iterator<PluginExecution> i = getExecutions().iterator(); i.hasNext(); )
{ {
PluginExecution exec = (PluginExecution) i.next(); PluginExecution exec = (PluginExecution) i.next();
@ -2832,7 +2832,7 @@
<version>4.0.0</version> <version>4.0.0</version>
<code> <code>
<![CDATA[ <![CDATA[
java.util.Map reportPluginMap; java.util.Map<String, ReportPlugin> reportPluginMap;
/** /**
* Reset the <code>reportPluginMap</code> field to <code>null</code> * Reset the <code>reportPluginMap</code> field to <code>null</code>
@ -2846,14 +2846,14 @@
* @return a Map of plugins field with <code>ReportPlugin#getKey()</code> as key * @return a Map of plugins field with <code>ReportPlugin#getKey()</code> as key
* @see org.apache.maven.model.ReportPlugin#getKey() * @see org.apache.maven.model.ReportPlugin#getKey()
*/ */
public synchronized java.util.Map getReportPluginsAsMap() public synchronized java.util.Map<String, ReportPlugin> getReportPluginsAsMap()
{ {
if ( reportPluginMap == null ) if ( reportPluginMap == null )
{ {
reportPluginMap = new java.util.LinkedHashMap(); reportPluginMap = new java.util.LinkedHashMap<String, ReportPlugin>();
if ( getPlugins() != null ) if ( getPlugins() != null )
{ {
for ( java.util.Iterator it = getPlugins().iterator(); it.hasNext(); ) for ( java.util.Iterator<ReportPlugin> it = getPlugins().iterator(); it.hasNext(); )
{ {
ReportPlugin reportPlugin = (ReportPlugin) it.next(); ReportPlugin reportPlugin = (ReportPlugin) it.next();
reportPluginMap.put( reportPlugin.getKey(), reportPlugin ); reportPluginMap.put( reportPlugin.getKey(), reportPlugin );
@ -3179,7 +3179,7 @@
<version>4.0.0</version> <version>4.0.0</version>
<code> <code>
<![CDATA[ <![CDATA[
private java.util.Map reportSetMap = null; private java.util.Map<String, ReportSet> reportSetMap = null;
/** /**
* Reset the <code>reportSetMap</code> field to <code>null</code> * Reset the <code>reportSetMap</code> field to <code>null</code>
@ -3193,14 +3193,14 @@
* @return a Map of reportSets field with <code>ReportSet#getId()</code> as key * @return a Map of reportSets field with <code>ReportSet#getId()</code> as key
* @see org.apache.maven.model.ReportSet#getId() * @see org.apache.maven.model.ReportSet#getId()
*/ */
public java.util.Map getReportSetsAsMap() public java.util.Map<String, ReportSet> getReportSetsAsMap()
{ {
if ( reportSetMap == null ) if ( reportSetMap == null )
{ {
reportSetMap = new java.util.LinkedHashMap(); reportSetMap = new java.util.LinkedHashMap<String, ReportSet>();
if ( getReportSets() != null ) if ( getReportSets() != null )
{ {
for ( java.util.Iterator i = getReportSets().iterator(); i.hasNext(); ) for ( java.util.Iterator<ReportSet> i = getReportSets().iterator(); i.hasNext(); )
{ {
ReportSet reportSet = (ReportSet) i.next(); ReportSet reportSet = (ReportSet) i.next();
reportSetMap.put( reportSet.getId(), reportSet ); reportSetMap.put( reportSet.getId(), reportSet );

View File

@ -64,9 +64,11 @@
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement; import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Prerequisites; import org.apache.maven.model.Prerequisites;
import org.apache.maven.model.Profile;
import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.ReportSet; import org.apache.maven.model.ReportSet;
import org.apache.maven.model.Reporting; import org.apache.maven.model.Reporting;
import org.apache.maven.model.Repository;
import org.apache.maven.model.Resource; import org.apache.maven.model.Resource;
import org.apache.maven.model.Scm; import org.apache.maven.model.Scm;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
@ -104,7 +106,7 @@ public class MavenProject
private File file; private File file;
private Set artifacts; private Set<Artifact> artifacts;
private Artifact parentArtifact; private Artifact parentArtifact;
@ -112,54 +114,54 @@ public class MavenProject
private List<ArtifactRepository> remoteArtifactRepositories; private List<ArtifactRepository> remoteArtifactRepositories;
private List collectedProjects = Collections.EMPTY_LIST; private List<MavenProject> collectedProjects = Collections.emptyList();
private List<Artifact> attachedArtifacts; private List<Artifact> attachedArtifacts;
private MavenProject executionProject; private MavenProject executionProject;
private List compileSourceRoots = new ArrayList(); private List<String> compileSourceRoots = new ArrayList<String>();
private List testCompileSourceRoots = new ArrayList(); private List<String> testCompileSourceRoots = new ArrayList<String>();
private List scriptSourceRoots = new ArrayList(); private List<String> scriptSourceRoots = new ArrayList<String>();
private List pluginArtifactRepositories; private List<ArtifactRepository> pluginArtifactRepositories;
private ArtifactRepository releaseArtifactRepository; private ArtifactRepository releaseArtifactRepository;
private ArtifactRepository snapshotArtifactRepository; private ArtifactRepository snapshotArtifactRepository;
private List activeProfiles = new ArrayList(); private List<Profile> activeProfiles = new ArrayList<Profile>();
private Set dependencyArtifacts; private Set<Artifact> dependencyArtifacts;
private Artifact artifact; private Artifact artifact;
// calculated. // calculated.
private Map artifactMap; private Map<String, Artifact> artifactMap;
private Model originalModel; private Model originalModel;
private Map pluginArtifactMap; private Map<String, Artifact> pluginArtifactMap;
private Set reportArtifacts; private Set<Artifact> reportArtifacts;
private Map reportArtifactMap; private Map<String, Artifact> reportArtifactMap;
private Set extensionArtifacts; private Set<Artifact> extensionArtifacts;
private Map extensionArtifactMap; private Map<String, Artifact> extensionArtifactMap;
private Map managedVersionMap; private Map<String, Artifact> managedVersionMap;
private Map projectReferences = new HashMap(); private Map<String, MavenProject> projectReferences = new HashMap<String, MavenProject>();
private boolean executionRoot; private boolean executionRoot;
private Map moduleAdjustments; private Map<String, String> moduleAdjustments;
private Stack previousExecutionProjects = new Stack(); private Stack<MavenProject> previousExecutionProjects = new Stack<MavenProject>();
//!! Components that need to be taken out of here //!! Components that need to be taken out of here
private ArtifactFactory artifactFactory; private ArtifactFactory artifactFactory;
@ -250,7 +252,7 @@ public MavenProject( Model model, ArtifactFactory artifactFactory, MavenTools ma
try try
{ {
LinkedHashSet repoSet = new LinkedHashSet(); Set<Repository> repoSet = new LinkedHashSet<Repository>();
if ( ( model.getRepositories() != null ) && !model.getRepositories().isEmpty() ) if ( ( model.getRepositories() != null ) && !model.getRepositories().isEmpty() )
{ {
repoSet.addAll( model.getRepositories() ); repoSet.addAll( model.getRepositories() );
@ -261,7 +263,7 @@ public MavenProject( Model model, ArtifactFactory artifactFactory, MavenTools ma
repoSet.addAll( model.getPluginRepositories() ); repoSet.addAll( model.getPluginRepositories() );
} }
setRemoteArtifactRepositories( mavenTools.buildArtifactRepositories( new ArrayList( repoSet ) ) ); setRemoteArtifactRepositories( mavenTools.buildArtifactRepositories( new ArrayList<Repository>( repoSet ) ) );
} }
catch ( Exception e ) catch ( Exception e )
{ {
@ -298,12 +300,12 @@ public String getModulePathAdjustment( MavenProject moduleProject )
if ( moduleAdjustments == null ) if ( moduleAdjustments == null )
{ {
moduleAdjustments = new HashMap(); moduleAdjustments = new HashMap<String, String>();
List modules = getModules(); List<String> modules = getModules();
if ( modules != null ) if ( modules != null )
{ {
for ( Iterator it = modules.iterator(); it.hasNext(); ) for ( Iterator<String> it = modules.iterator(); it.hasNext(); )
{ {
String modulePath = (String) it.next(); String modulePath = (String) it.next();
String moduleName = modulePath; String moduleName = modulePath;
@ -403,7 +405,7 @@ public void setParent( MavenProject parent )
this.parent = parent; this.parent = parent;
} }
public void setRemoteArtifactRepositories( List remoteArtifactRepositories ) public void setRemoteArtifactRepositories( List<ArtifactRepository> remoteArtifactRepositories )
{ {
this.remoteArtifactRepositories = remoteArtifactRepositories; this.remoteArtifactRepositories = remoteArtifactRepositories;
} }
@ -441,12 +443,12 @@ public File getBasedir()
} }
} }
public void setDependencies( List dependencies ) public void setDependencies( List<Dependency> dependencies )
{ {
getModel().setDependencies( dependencies ); getModel().setDependencies( dependencies );
} }
public List getDependencies() public List<Dependency> getDependencies()
{ {
return getModel().getDependencies(); return getModel().getDependencies();
} }
@ -505,29 +507,29 @@ public void addTestCompileSourceRoot( String path )
} }
} }
public List getCompileSourceRoots() public List<String> getCompileSourceRoots()
{ {
return compileSourceRoots; return compileSourceRoots;
} }
public List getScriptSourceRoots() public List<String> getScriptSourceRoots()
{ {
return scriptSourceRoots; return scriptSourceRoots;
} }
public List getTestCompileSourceRoots() public List<String> getTestCompileSourceRoots()
{ {
return testCompileSourceRoots; return testCompileSourceRoots;
} }
public List getCompileClasspathElements() public List<String> getCompileClasspathElements()
throws DependencyResolutionRequiredException throws DependencyResolutionRequiredException
{ {
List list = new ArrayList( getArtifacts().size() ); List<String> list = new ArrayList<String>( getArtifacts().size() + 1 );
list.add( getBuild().getOutputDirectory() ); list.add( getBuild().getOutputDirectory() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -544,11 +546,11 @@ public List getCompileClasspathElements()
return list; return list;
} }
public List getCompileArtifacts() public List<Artifact> getCompileArtifacts()
{ {
List list = new ArrayList( getArtifacts().size() ); List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -566,18 +568,18 @@ public List getCompileArtifacts()
return list; return list;
} }
public List getCompileDependencies() public List<Dependency> getCompileDependencies()
{ {
Set artifacts = getArtifacts(); Set<Artifact> artifacts = getArtifacts();
if ( ( artifacts == null ) || artifacts.isEmpty() ) if ( ( artifacts == null ) || artifacts.isEmpty() )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
List list = new ArrayList( artifacts.size() ); List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -600,16 +602,16 @@ public List getCompileDependencies()
return list; return list;
} }
public List getTestClasspathElements() public List<String> getTestClasspathElements()
throws DependencyResolutionRequiredException throws DependencyResolutionRequiredException
{ {
List list = new ArrayList( getArtifacts().size() + 2 ); List<String> list = new ArrayList<String>( getArtifacts().size() + 2 );
list.add( getBuild().getTestOutputDirectory() ); list.add( getBuild().getTestOutputDirectory() );
list.add( getBuild().getOutputDirectory() ); list.add( getBuild().getOutputDirectory() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -626,11 +628,11 @@ public List getTestClasspathElements()
return list; return list;
} }
public List getTestArtifacts() public List<Artifact> getTestArtifacts()
{ {
List list = new ArrayList( getArtifacts().size() ); List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -643,18 +645,18 @@ public List getTestArtifacts()
return list; return list;
} }
public List getTestDependencies() public List<Dependency> getTestDependencies()
{ {
Set artifacts = getArtifacts(); Set<Artifact> artifacts = getArtifacts();
if ( ( artifacts == null ) || artifacts.isEmpty() ) if ( ( artifacts == null ) || artifacts.isEmpty() )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
List list = new ArrayList( artifacts.size() ); List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -672,14 +674,14 @@ public List getTestDependencies()
return list; return list;
} }
public List getRuntimeClasspathElements() public List<String> getRuntimeClasspathElements()
throws DependencyResolutionRequiredException throws DependencyResolutionRequiredException
{ {
List list = new ArrayList( getArtifacts().size() + 1 ); List<String> list = new ArrayList<String>( getArtifacts().size() + 1 );
list.add( getBuild().getOutputDirectory() ); list.add( getBuild().getOutputDirectory() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -700,11 +702,11 @@ public List getRuntimeClasspathElements()
return list; return list;
} }
public List getRuntimeArtifacts() public List<Artifact> getRuntimeArtifacts()
{ {
List list = new ArrayList( getArtifacts().size() ); List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -721,18 +723,18 @@ public List getRuntimeArtifacts()
return list; return list;
} }
public List getRuntimeDependencies() public List<Dependency> getRuntimeDependencies()
{ {
Set artifacts = getArtifacts(); Set<Artifact> artifacts = getArtifacts();
if ( ( artifacts == null ) || artifacts.isEmpty() ) if ( ( artifacts == null ) || artifacts.isEmpty() )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
List list = new ArrayList( artifacts.size() ); List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
for ( Iterator i = artifacts.iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = artifacts.iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -754,14 +756,14 @@ public List getRuntimeDependencies()
return list; return list;
} }
public List getSystemClasspathElements() public List<String> getSystemClasspathElements()
throws DependencyResolutionRequiredException throws DependencyResolutionRequiredException
{ {
List list = new ArrayList( getArtifacts().size() ); List<String> list = new ArrayList<String>( getArtifacts().size() );
list.add( getBuild().getOutputDirectory() ); list.add( getBuild().getOutputDirectory() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -777,11 +779,11 @@ public List getSystemClasspathElements()
return list; return list;
} }
public List getSystemArtifacts() public List<Artifact> getSystemArtifacts()
{ {
List list = new ArrayList( getArtifacts().size() ); List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -798,18 +800,18 @@ public List getSystemArtifacts()
return list; return list;
} }
public List getSystemDependencies() public List<Dependency> getSystemDependencies()
{ {
Set artifacts = getArtifacts(); Set<Artifact> artifacts = getArtifacts();
if ( ( artifacts == null ) || artifacts.isEmpty() ) if ( ( artifacts == null ) || artifacts.isEmpty() )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
List list = new ArrayList( artifacts.size() ); List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) for ( Iterator<Artifact> i = getArtifacts().iterator(); i.hasNext(); )
{ {
Artifact a = (Artifact) i.next(); Artifact a = (Artifact) i.next();
@ -1007,12 +1009,12 @@ public Scm getScm()
return getModel().getScm(); return getModel().getScm();
} }
public void setMailingLists( List mailingLists ) public void setMailingLists( List<MailingList> mailingLists )
{ {
getModel().setMailingLists( mailingLists ); getModel().setMailingLists( mailingLists );
} }
public List getMailingLists() public List<MailingList> getMailingLists()
{ {
return getModel().getMailingLists(); return getModel().getMailingLists();
} }
@ -1022,12 +1024,12 @@ public void addMailingList( MailingList mailingList )
getModel().addMailingList( mailingList ); getModel().addMailingList( mailingList );
} }
public void setDevelopers( List developers ) public void setDevelopers( List<Developer> developers )
{ {
getModel().setDevelopers( developers ); getModel().setDevelopers( developers );
} }
public List getDevelopers() public List<Developer> getDevelopers()
{ {
return getModel().getDevelopers(); return getModel().getDevelopers();
} }
@ -1037,12 +1039,12 @@ public void addDeveloper( Developer developer )
getModel().addDeveloper( developer ); getModel().addDeveloper( developer );
} }
public void setContributors( List contributors ) public void setContributors( List<Contributor> contributors )
{ {
getModel().setContributors( contributors ); getModel().setContributors( contributors );
} }
public List getContributors() public List<Contributor> getContributors()
{ {
return getModel().getContributors(); return getModel().getContributors();
} }
@ -1062,12 +1064,12 @@ public Build getBuild()
return getModelBuild(); return getModelBuild();
} }
public List getResources() public List<Resource> getResources()
{ {
return getBuild().getResources(); return getBuild().getResources();
} }
public List getTestResources() public List<Resource> getTestResources()
{ {
return getBuild().getTestResources(); return getBuild().getTestResources();
} }
@ -1092,12 +1094,12 @@ public Reporting getReporting()
return getModel().getReporting(); return getModel().getReporting();
} }
public void setLicenses( List licenses ) public void setLicenses( List<License> licenses )
{ {
getModel().setLicenses( licenses ); getModel().setLicenses( licenses );
} }
public List getLicenses() public List<License> getLicenses()
{ {
return getModel().getLicenses(); return getModel().getLicenses();
} }
@ -1107,7 +1109,7 @@ public void addLicense( License license )
getModel().addLicense( license ); getModel().addLicense( license );
} }
public void setArtifacts( Set artifacts ) public void setArtifacts( Set<Artifact> artifacts )
{ {
this.artifacts = artifacts; this.artifacts = artifacts;
@ -1123,12 +1125,12 @@ public void setArtifacts( Set artifacts )
* @return {@link Set} &lt; {@link Artifact} > * @return {@link Set} &lt; {@link Artifact} >
* @see #getDependencyArtifacts() to get only direct dependencies * @see #getDependencyArtifacts() to get only direct dependencies
*/ */
public Set getArtifacts() public Set<Artifact> getArtifacts()
{ {
return artifacts == null ? Collections.EMPTY_SET : artifacts; return artifacts == null ? Collections.<Artifact> emptySet() : artifacts;
} }
public Map getArtifactMap() public Map<String, Artifact> getArtifactMap()
{ {
if ( artifactMap == null ) if ( artifactMap == null )
{ {
@ -1137,17 +1139,17 @@ public Map getArtifactMap()
return artifactMap; return artifactMap;
} }
public Set getPluginArtifacts() public Set<Artifact> getPluginArtifacts()
{ {
if ( pluginArtifacts != null ) if ( pluginArtifacts != null )
{ {
return pluginArtifacts; return pluginArtifacts;
} }
pluginArtifacts = new HashSet(); pluginArtifacts = new HashSet<Artifact>();
if ( artifactFactory != null ) if ( artifactFactory != null )
{ {
List plugins = getBuildPlugins(); List<Plugin> plugins = getBuildPlugins();
for ( Iterator i = plugins.iterator(); i.hasNext(); ) for ( Iterator<Plugin> i = plugins.iterator(); i.hasNext(); )
{ {
Plugin p = (Plugin) i.next(); Plugin p = (Plugin) i.next();
@ -1182,31 +1184,31 @@ public Set getPluginArtifacts()
return pluginArtifacts; return pluginArtifacts;
} }
public Map getPluginArtifactMap() public Map<String, Artifact> getPluginArtifactMap()
{ {
pluginArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getPluginArtifacts() ); pluginArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getPluginArtifacts() );
return pluginArtifactMap; return pluginArtifactMap;
} }
public void setReportArtifacts( Set reportArtifacts ) public void setReportArtifacts( Set<Artifact> reportArtifacts )
{ {
this.reportArtifacts = reportArtifacts; this.reportArtifacts = reportArtifacts;
reportArtifactMap = null; reportArtifactMap = null;
} }
public Set getReportArtifacts() public Set<Artifact> getReportArtifacts()
{ {
if( reportArtifacts != null ) if( reportArtifacts != null )
{ {
return reportArtifacts; return reportArtifacts;
} }
reportArtifacts = new HashSet(); reportArtifacts = new HashSet<Artifact>();
List reports = getReportPlugins(); List<ReportPlugin> reports = getReportPlugins();
if ( reports != null ) if ( reports != null )
{ {
for ( Iterator i = reports.iterator(); i.hasNext(); ) for ( Iterator<ReportPlugin> i = reports.iterator(); i.hasNext(); )
{ {
ReportPlugin p = (ReportPlugin) i.next(); ReportPlugin p = (ReportPlugin) i.next();
@ -1241,7 +1243,7 @@ public Set getReportArtifacts()
return reportArtifacts; return reportArtifacts;
} }
public Map getReportArtifactMap() public Map<String, Artifact> getReportArtifactMap()
{ {
if ( reportArtifactMap == null ) if ( reportArtifactMap == null )
{ {
@ -1251,24 +1253,24 @@ public Map getReportArtifactMap()
return reportArtifactMap; return reportArtifactMap;
} }
public void setExtensionArtifacts( Set extensionArtifacts ) public void setExtensionArtifacts( Set<Artifact> extensionArtifacts )
{ {
this.extensionArtifacts = extensionArtifacts; this.extensionArtifacts = extensionArtifacts;
extensionArtifactMap = null; extensionArtifactMap = null;
} }
public Set getExtensionArtifacts() public Set<Artifact> getExtensionArtifacts()
{ {
if( extensionArtifacts != null ) if( extensionArtifacts != null )
{ {
return extensionArtifacts; return extensionArtifacts;
} }
extensionArtifacts = new HashSet(); extensionArtifacts = new HashSet<Artifact>();
List extensions = getBuildExtensions(); List<Extension> extensions = getBuildExtensions();
if ( extensions != null ) if ( extensions != null )
{ {
for ( Iterator i = extensions.iterator(); i.hasNext(); ) for ( Iterator<Extension> i = extensions.iterator(); i.hasNext(); )
{ {
Extension ext = (Extension) i.next(); Extension ext = (Extension) i.next();
@ -1304,7 +1306,7 @@ public Set getExtensionArtifacts()
return extensionArtifacts; return extensionArtifacts;
} }
public Map getExtensionArtifactMap() public Map<String, Artifact> getExtensionArtifactMap()
{ {
if ( extensionArtifactMap == null ) if ( extensionArtifactMap == null )
{ {
@ -1329,7 +1331,7 @@ public Artifact getParentArtifact()
return parentArtifact; return parentArtifact;
} }
public List getRepositories() public List<Repository> getRepositories()
{ {
return getModel().getRepositories(); return getModel().getRepositories();
} }
@ -1338,26 +1340,26 @@ public List getRepositories()
// Plugins // Plugins
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
public List getReportPlugins() public List<ReportPlugin> getReportPlugins()
{ {
if ( getModel().getReporting() == null ) if ( getModel().getReporting() == null )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
return getModel().getReporting().getPlugins(); return getModel().getReporting().getPlugins();
} }
public List getBuildPlugins() public List<Plugin> getBuildPlugins()
{ {
if ( getModel().getBuild() == null ) if ( getModel().getBuild() == null )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
return getModel().getBuild().getPlugins(); return getModel().getBuild().getPlugins();
} }
public List getModules() public List<String> getModules()
{ {
return getModel().getModules(); return getModel().getModules();
} }
@ -1409,7 +1411,7 @@ public void injectPluginManagementInfo( Plugin plugin )
if ( pm != null ) if ( pm != null )
{ {
Map pmByKey = pm.getPluginsAsMap(); Map<String, Plugin> pmByKey = pm.getPluginsAsMap();
String pluginKey = plugin.getKey(); String pluginKey = plugin.getKey();
@ -1422,17 +1424,17 @@ public void injectPluginManagementInfo( Plugin plugin )
} }
} }
public List getCollectedProjects() public List<MavenProject> getCollectedProjects()
{ {
return collectedProjects; return collectedProjects;
} }
public void setCollectedProjects( List collectedProjects ) public void setCollectedProjects( List<MavenProject> collectedProjects )
{ {
this.collectedProjects = collectedProjects; this.collectedProjects = collectedProjects;
} }
public void setPluginArtifactRepositories( List pluginArtifactRepositories ) public void setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
{ {
this.pluginArtifactRepositories = pluginArtifactRepositories; this.pluginArtifactRepositories = pluginArtifactRepositories;
} }
@ -1441,7 +1443,7 @@ public void setPluginArtifactRepositories( List pluginArtifactRepositories )
* @return a list of ArtifactRepository objects constructed * @return a list of ArtifactRepository objects constructed
* from the Repository objects returned by getPluginRepositories. * from the Repository objects returned by getPluginRepositories.
*/ */
public List getPluginArtifactRepositories() public List<ArtifactRepository> getPluginArtifactRepositories()
{ {
return getRemoteArtifactRepositories(); return getRemoteArtifactRepositories();
} }
@ -1453,18 +1455,18 @@ public ArtifactRepository getDistributionManagementArtifactRepository()
: getReleaseArtifactRepository(); : getReleaseArtifactRepository();
} }
public List getPluginRepositories() public List<Repository> getPluginRepositories()
{ {
// return model.getPluginRepositories(); // return model.getPluginRepositories();
return getModel().getRepositories(); return getModel().getRepositories();
} }
public void setActiveProfiles( List activeProfiles ) public void setActiveProfiles( List<Profile> activeProfiles )
{ {
this.activeProfiles.addAll( activeProfiles ); this.activeProfiles.addAll( activeProfiles );
} }
public List getActiveProfiles() public List<Profile> getActiveProfiles()
{ {
return activeProfiles; return activeProfiles;
} }
@ -1472,7 +1474,7 @@ public List getActiveProfiles()
public void addAttachedArtifact( Artifact artifact ) public void addAttachedArtifact( Artifact artifact )
throws DuplicateArtifactAttachmentException throws DuplicateArtifactAttachmentException
{ {
List attachedArtifacts = getAttachedArtifacts(); List<Artifact> attachedArtifacts = getAttachedArtifacts();
if ( attachedArtifacts.contains( artifact ) ) if ( attachedArtifacts.contains( artifact ) )
{ {
@ -1507,7 +1509,7 @@ public Xpp3Dom getReportConfiguration( String pluginGroupId, String pluginArtifa
if ( getReportPlugins() != null ) if ( getReportPlugins() != null )
{ {
for ( Iterator iterator = getReportPlugins().iterator(); iterator.hasNext(); ) for ( Iterator<ReportPlugin> iterator = getReportPlugins().iterator(); iterator.hasNext(); )
{ {
ReportPlugin plugin = (ReportPlugin) iterator.next(); ReportPlugin plugin = (ReportPlugin) iterator.next();
@ -1563,12 +1565,12 @@ public void setExecutionProject( MavenProject executionProject )
* @return {@link Set} &lt; {@link Artifact} > * @return {@link Set} &lt; {@link Artifact} >
* @see #getArtifacts() to get all transitive dependencies * @see #getArtifacts() to get all transitive dependencies
*/ */
public Set getDependencyArtifacts() public Set<Artifact> getDependencyArtifacts()
{ {
return dependencyArtifacts; return dependencyArtifacts;
} }
public void setDependencyArtifacts( Set dependencyArtifacts ) public void setDependencyArtifacts( Set<Artifact> dependencyArtifacts )
{ {
this.dependencyArtifacts = dependencyArtifacts; this.dependencyArtifacts = dependencyArtifacts;
} }
@ -1593,29 +1595,29 @@ public Model getOriginalModel()
return originalModel; return originalModel;
} }
public void setManagedVersionMap( Map map ) public void setManagedVersionMap( Map<String, Artifact> map )
{ {
managedVersionMap = map; managedVersionMap = map;
} }
public Map getManagedVersionMap() public Map<String, Artifact> getManagedVersionMap()
{ {
if ( managedVersionMap != null ) if ( managedVersionMap != null )
{ {
return managedVersionMap; return managedVersionMap;
} }
Map map = null; Map<String, Artifact> map = null;
if ( artifactFactory != null ) if ( artifactFactory != null )
{ {
List deps; List<Dependency> deps;
DependencyManagement dependencyManagement = getDependencyManagement(); DependencyManagement dependencyManagement = getDependencyManagement();
if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) && if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) &&
( deps.size() > 0 ) ) ( deps.size() > 0 ) )
{ {
map = new ManagedVersionMap( map ); map = new ManagedVersionMap( map );
for ( Iterator i = dependencyManagement.getDependencies().iterator(); i.hasNext(); ) for ( Iterator<Dependency> i = dependencyManagement.getDependencies().iterator(); i.hasNext(); )
{ {
Dependency d = (Dependency) i.next(); Dependency d = (Dependency) i.next();
@ -1639,9 +1641,9 @@ public Map getManagedVersionMap()
if ( ( null != d.getExclusions() ) && !d.getExclusions().isEmpty() ) if ( ( null != d.getExclusions() ) && !d.getExclusions().isEmpty() )
{ {
List exclusions = new ArrayList(); List<String> exclusions = new ArrayList<String>();
for ( Iterator j = d.getExclusions().iterator(); j.hasNext(); ) for ( Iterator<Exclusion> j = d.getExclusions().iterator(); j.hasNext(); )
{ {
Exclusion e = (Exclusion) j.next(); Exclusion e = (Exclusion) j.next();
@ -1661,13 +1663,13 @@ public Map getManagedVersionMap()
} }
catch ( InvalidVersionSpecificationException e ) catch ( InvalidVersionSpecificationException e )
{ {
map = Collections.EMPTY_MAP; map = Collections.emptyMap();
} }
} }
} }
else if ( map == null ) else if ( map == null )
{ {
map = Collections.EMPTY_MAP; map = Collections.emptyMap();
} }
} }
managedVersionMap = map; managedVersionMap = map;
@ -1699,12 +1701,12 @@ public int hashCode()
return getId().hashCode(); return getId().hashCode();
} }
public List getBuildExtensions() public List<Extension> getBuildExtensions()
{ {
Build build = getBuild(); Build build = getBuild();
if ( ( build == null ) || ( build.getExtensions() == null ) ) if ( ( build == null ) || ( build.getExtensions() == null ) )
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
else else
{ {
@ -1716,7 +1718,7 @@ public List getBuildExtensions()
* @return {@link Set} &lt; {@link Artifact} > * @return {@link Set} &lt; {@link Artifact} >
* @todo the lazy initialisation of this makes me uneasy. * @todo the lazy initialisation of this makes me uneasy.
*/ */
public Set createArtifacts( ArtifactFactory artifactFactory, String inheritedScope, public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String inheritedScope,
ArtifactFilter dependencyFilter ) ArtifactFilter dependencyFilter )
throws InvalidDependencyVersionException throws InvalidDependencyVersionException
{ {
@ -1743,12 +1745,12 @@ public Properties getProperties()
return getModel().getProperties(); return getModel().getProperties();
} }
public List getFilters() public List<String> getFilters()
{ {
return getBuild().getFilters(); return getBuild().getFilters();
} }
public Map getProjectReferences() public Map<String, MavenProject> getProjectReferences()
{ {
return projectReferences; return projectReferences;
} }
@ -1796,7 +1798,7 @@ public Artifact replaceWithActiveArtifact( Artifact pluginArtifact )
} }
} }
Iterator itr = ref.getAttachedArtifacts().iterator(); Iterator<Artifact> itr = ref.getAttachedArtifacts().iterator();
while ( itr.hasNext() ) while ( itr.hasNext() )
{ {
Artifact attached = (Artifact) itr.next(); Artifact attached = (Artifact) itr.next();
@ -1904,22 +1906,22 @@ protected void setModel( Model model )
this.model = model; this.model = model;
} }
protected void setAttachedArtifacts( List attachedArtifacts ) protected void setAttachedArtifacts( List<Artifact> attachedArtifacts )
{ {
this.attachedArtifacts = attachedArtifacts; this.attachedArtifacts = attachedArtifacts;
} }
protected void setCompileSourceRoots( List compileSourceRoots ) protected void setCompileSourceRoots( List<String> compileSourceRoots )
{ {
this.compileSourceRoots = compileSourceRoots; this.compileSourceRoots = compileSourceRoots;
} }
protected void setTestCompileSourceRoots( List testCompileSourceRoots ) protected void setTestCompileSourceRoots( List<String> testCompileSourceRoots )
{ {
this.testCompileSourceRoots = testCompileSourceRoots; this.testCompileSourceRoots = testCompileSourceRoots;
} }
protected void setScriptSourceRoots( List scriptSourceRoots ) protected void setScriptSourceRoots( List<String> scriptSourceRoots )
{ {
this.scriptSourceRoots = scriptSourceRoots; this.scriptSourceRoots = scriptSourceRoots;
} }
@ -1994,23 +1996,23 @@ private void deepCopy( MavenProject project )
if ( project.getAttachedArtifacts() != null ) if ( project.getAttachedArtifacts() != null )
{ {
// clone properties modifyable by plugins in a forked lifecycle // clone properties modifyable by plugins in a forked lifecycle
setAttachedArtifacts( new ArrayList( project.getAttachedArtifacts() ) ); setAttachedArtifacts( new ArrayList<Artifact>( project.getAttachedArtifacts() ) );
} }
if ( project.getCompileSourceRoots() != null ) if ( project.getCompileSourceRoots() != null )
{ {
// clone source roots // clone source roots
setCompileSourceRoots( ( new ArrayList( project.getCompileSourceRoots() ) ) ); setCompileSourceRoots( ( new ArrayList<String>( project.getCompileSourceRoots() ) ) );
} }
if ( project.getTestCompileSourceRoots() != null ) if ( project.getTestCompileSourceRoots() != null )
{ {
setTestCompileSourceRoots( ( new ArrayList( project.getTestCompileSourceRoots() ) ) ); setTestCompileSourceRoots( ( new ArrayList<String>( project.getTestCompileSourceRoots() ) ) );
} }
if ( project.getScriptSourceRoots() != null ) if ( project.getScriptSourceRoots() != null )
{ {
setScriptSourceRoots( ( new ArrayList( project.getScriptSourceRoots() ) ) ); setScriptSourceRoots( ( new ArrayList<String>( project.getScriptSourceRoots() ) ) );
} }
setModel( project.getModel() ); setModel( project.getModel() );
@ -2043,7 +2045,7 @@ private void deepCopy( MavenProject project )
} }
} }
private void addArtifactPath( Artifact a, List list ) private void addArtifactPath( Artifact a, List<String> list )
throws DependencyResolutionRequiredException throws DependencyResolutionRequiredException
{ {
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() ); String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );

View File

@ -185,6 +185,9 @@ under the License.
<groupId>org.codehaus.modello</groupId> <groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId> <artifactId>modello-maven-plugin</artifactId>
<version>${modelloVersion}</version> <version>${modelloVersion}</version>
<configuration>
<useJava5>true</useJava5>
</configuration>
<executions> <executions>
<execution> <execution>
<id>site-docs</id> <id>site-docs</id>
@ -413,8 +416,8 @@ under the License.
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-jxpath</groupId> <groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId> <artifactId>commons-jxpath</artifactId>
<version>${jxpathVersion}</version> <version>${jxpathVersion}</version>
</dependency> </dependency>