Author: sisbell
Date: Thu Aug 14 20:08:47 2008
New Revision: 686127

URL: http://svn.apache.org/viewvc?rev=686127&view=rev
Log:
Moved report extension artifact creation 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=686127&r1=686126&r2=686127&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 14 20:08:47 2008
@@ -678,12 +678,6 @@
             e.printStackTrace();
         }
 
-        String projectId = safeVersionlessKey( model.getGroupId(), 
model.getArtifactId() );
-
-        project.setReportArtifacts( createReportArtifacts( projectId, 
project.getReportPlugins(), pomFile ) );
-
-        project.setExtensionArtifacts( createExtensionArtifacts( projectId, 
project.getBuildExtensions(), pomFile ) );
-
         return project;
     }
 
@@ -846,97 +840,6 @@
         }
     }
 
-    // TODO: share with createPluginArtifacts?
-    protected Set createReportArtifacts( String projectId,
-                                         List reports, File pomLocation )
-        throws ProjectBuildingException
-    {
-        Set pluginArtifacts = new HashSet();
-
-        if ( reports != null )
-        {
-            for ( Iterator i = reports.iterator(); i.hasNext(); )
-            {
-                ReportPlugin p = (ReportPlugin) 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, 
"Report plugin: " + p.getKey(), version, pomLocation, e );
-                }
-
-                if ( artifact != null )
-                {
-                    pluginArtifacts.add( artifact );
-                }
-            }
-        }
-
-        return pluginArtifacts;
-    }
-
-    // TODO: share with createPluginArtifacts?
-    protected Set createExtensionArtifacts( String projectId,
-                                            List extensions, File pomFile )
-        throws ProjectBuildingException
-    {
-        Set extensionArtifacts = new HashSet();
-
-        if ( extensions != null )
-        {
-            for ( Iterator i = extensions.iterator(); i.hasNext(); )
-            {
-                Extension ext = (Extension) i.next();
-
-                String version;
-                if ( StringUtils.isEmpty( ext.getVersion() ) )
-                {
-                    version = "RELEASE";
-                }
-                else
-                {
-                    version = ext.getVersion();
-                }
-
-                Artifact artifact;
-                try
-                {
-                    VersionRange versionRange = 
VersionRange.createFromVersionSpec( version );
-                    artifact =
-                        artifactFactory.createExtensionArtifact( 
ext.getGroupId(), ext.getArtifactId(), versionRange );
-                }
-                catch ( InvalidVersionSpecificationException e )
-                {
-                    String key = ArtifactUtils.versionlessKey( 
ext.getGroupId(), ext.getArtifactId() );
-                    throw new InvalidProjectVersionException( projectId, 
"Extension: " + key,
-                                                              version, 
pomFile, e );
-                }
-
-                if ( artifact != null )
-                {
-                    extensionArtifacts.add( artifact );
-                }
-            }
-        }
-
-        return extensionArtifacts;
-    }
-
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

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=686127&r1=686126&r2=686127&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 14 20:08:47 2008
@@ -1262,6 +1262,43 @@
 
     public Set getExtensionArtifacts()
     {
+        Set extensionArtifacts = new HashSet();
+        List extensions = getBuildExtensions();
+        if ( extensions != null )
+        {
+            for ( Iterator i = extensions.iterator(); i.hasNext(); )
+            {
+                Extension ext = (Extension) i.next();
+
+                String version;
+                if ( StringUtils.isEmpty( ext.getVersion() ) )
+                {
+                    version = "RELEASE";
+                }
+                else
+                {
+                    version = ext.getVersion();
+                }
+
+                Artifact artifact = null;
+                try
+                {
+                    VersionRange versionRange = 
VersionRange.createFromVersionSpec( version );
+                    artifact =
+                        artifactFactory.createExtensionArtifact( 
ext.getGroupId(), ext.getArtifactId(), versionRange );
+                }
+                catch ( InvalidVersionSpecificationException e )
+                {
+
+                }
+
+                if ( artifact != null )
+                {
+                    extensionArtifacts.add( artifact );
+                }
+            }
+        }
+        extensionArtifactMap = null;
         return extensionArtifacts;
     }
 


Reply via email to