You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2008/08/08 00:24:16 UTC
svn commit: r683737 - in
/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project:
DefaultMavenProjectBuilder.java MavenProject.java
Author: sisbell
Date: Thu Aug 7 15:24:15 2008
New Revision: 683737
URL: http://svn.apache.org/viewvc?rev=683737&view=rev
Log:
Moved plugin artifact creation from builder to maven project.
Modified:
maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=683737&r1=683736&r2=683737&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Thu Aug 7 15:24:15 2008
@@ -935,9 +935,6 @@
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
- // TODO: these aren't taking active project artifacts into consideration in the reactor
- project.setPluginArtifacts( createPluginArtifacts( projectId, project.getBuildPlugins(), pomFile ) );
-
project.setReportArtifacts( createReportArtifacts( projectId, project.getReportPlugins(), pomFile ) );
project.setExtensionArtifacts( createExtensionArtifacts( projectId, project.getBuildExtensions(), pomFile ) );
@@ -1217,70 +1214,6 @@
}
/**
- * @deprecated use {@link #createPluginArtifacts(String, List, File)}
- * @param projectId
- * @param plugins
- * @param pomLocation absolute path of pom file
- * @return
- * @throws ProjectBuildingException
- */
- @Deprecated
- protected Set createPluginArtifacts( String projectId,
- List plugins, String pomLocation )
- throws ProjectBuildingException
- {
- return createPluginArtifacts( projectId, plugins, new File( pomLocation ) );
- }
-
- /**
- *
- * @param projectId
- * @param plugins
- * @param pomLocation pom file
- * @return
- * @throws ProjectBuildingException
- */
- protected Set createPluginArtifacts( String projectId,
- List plugins, File pomLocation )
- throws ProjectBuildingException
- {
- Set pluginArtifacts = new HashSet();
-
- for ( Iterator i = plugins.iterator(); i.hasNext(); )
- {
- Plugin p = (Plugin) i.next();
-
- String version;
- if ( StringUtils.isEmpty( p.getVersion() ) )
- {
- version = "RELEASE";
- }
- else
- {
- version = p.getVersion();
- }
-
- Artifact artifact;
- try
- {
- artifact = artifactFactory.createPluginArtifact( p.getGroupId(), p.getArtifactId(),
- VersionRange.createFromVersionSpec( version ) );
- }
- catch ( InvalidVersionSpecificationException e )
- {
- throw new InvalidProjectVersionException( projectId, "Plugin: " + p.getKey(), version, pomLocation, e );
- }
-
- if ( artifact != null )
- {
- pluginArtifacts.add( artifact );
- }
- }
-
- return pluginArtifacts;
- }
-
- /**
* @deprecated use {@link #createReportArtifacts(String, List, File)}
* @param projectId
* @param reports
Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=683737&r1=683736&r2=683737&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Thu Aug 7 15:24:15 2008
@@ -35,19 +35,12 @@
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.artifact.MavenMetadataSource;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
+import java.util.*;
/**
* The concern of the project is provide runtime values based on the model. <p/>
@@ -1161,6 +1154,41 @@
public Set getPluginArtifacts()
{
+ Set pa = new HashSet();
+ if(pluginArtifacts == null && artifactFactory != null) {
+ List plugins = getBuildPlugins();
+ for ( Iterator i = plugins.iterator(); i.hasNext(); )
+ {
+ Plugin p = (Plugin) i.next();
+
+ String version;
+ if ( StringUtils.isEmpty( p.getVersion() ) )
+ {
+ version = "RELEASE";
+ }
+ else
+ {
+ version = p.getVersion();
+ }
+
+ Artifact artifact;
+ try
+ {
+ artifact = artifactFactory.createPluginArtifact( p.getGroupId(), p.getArtifactId(),
+ VersionRange.createFromVersionSpec( version ) );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ return pa;
+ }
+
+ if ( artifact != null )
+ {
+ pa.add( artifact );
+ }
+ }
+ }
+ pluginArtifacts = pa;
return pluginArtifacts;
}
@@ -1562,7 +1590,7 @@
}
Map map = null;
- if( managedVersionMap == null && artifactFactory != null ) {
+ if( artifactFactory != null ) {
List deps;
DependencyManagement dependencyManagement = getDependencyManagement();