maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r391918 - /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
Date Thu, 06 Apr 2006 06:58:35 GMT
Author: brett
Date: Wed Apr  5 23:58:34 2006
New Revision: 391918

URL: http://svn.apache.org/viewcvs?rev=391918&view=rev
Log:
[MSITE-71] use the project builder to read the parent project from reactor, relative path,
repository (in that order) to find an interpolated parent URL

Modified:
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=391918&r1=391917&r2=391918&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
(original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
Wed Apr  5 23:58:34 2006
@@ -394,6 +394,8 @@
      * if available (reactor env model attributes are interpolated), or if the
      * reactor is unavailable (-N) resorts to the project.getParent().getUrl() value
      * which will NOT have be interpolated.
+     * <p/>
+     * TODO: once bug is fixed in Maven proper, remove this
      *
      * @return parent project URL.
      */
@@ -420,6 +422,40 @@
                         url = reactorProject.getUrl();
                         break;
                     }
+                }
+            }
+
+            if ( url == null )
+            {
+                try
+                {
+                    MavenProject mavenProject = mavenProjectBuilder.build(
+                        new File( project.getBasedir(), project.getModel().getParent().getRelativePath()
),
+                        localRepository, null );
+                    if ( mavenProject.getGroupId().equals( project.getParent().getGroupId()
) &&
+                        mavenProject.getArtifactId().equals( project.getParent().getArtifactId()
) &&
+                        mavenProject.getVersion().equals( project.getParent().getVersion()
) )
+                    {
+                        url = mavenProject.getUrl();
+                    }
+                }
+                catch ( ProjectBuildingException e )
+                {
+                    getLog().warn( "Unable to load parent project from repository: " + e.getMessage()
);
+                }
+            }
+
+            if ( url == null )
+            {
+                try
+                {
+                    url = mavenProjectBuilder.buildFromRepository( project.getParentArtifact(),
+                                                                   project.getRemoteArtifactRepositories(),
+                                                                   localRepository ).getUrl();
+                }
+                catch ( ProjectBuildingException e )
+                {
+                    getLog().warn( "Unable to load parent project from repository: " + e.getMessage()
);
                 }
             }
 



Mime
View raw message