You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/04/06 10:16:43 UTC
svn commit: r391930 -
/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java
Author: brett
Date: Thu Apr 6 01:16:38 2006
New Revision: 391930
URL: http://svn.apache.org/viewcvs?rev=391930&view=rev
Log:
allow site stage to have parent's outside of the execution root
Modified:
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java
Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java?rev=391930&r1=391929&r2=391930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java Thu Apr 6 01:16:38 2006
@@ -86,7 +86,7 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
- String structureProject = getStructure( project );
+ String structureProject = getStructure( project, false );
outputDirectory = new File( stagingDirectory, structureProject );
@@ -97,8 +97,11 @@
MavenProject parent = getParentProject( project );
if ( parent != null )
{
- String structureParentProject = getStructure( parent );
- parent.setUrl( outputRelativePath + "/" + structureParentProject );
+ String structureParentProject = getStructure( parent, true );
+ if ( structureParentProject != null )
+ {
+ parent.setUrl( outputRelativePath + "/" + structureParentProject );
+ }
}
if ( reactorProjects != null && reactorProjects.size() > 1 )
@@ -112,7 +115,7 @@
if ( reactorProject != null && reactorProject.getParent() != null &&
project.getArtifactId().equals( reactorProject.getParent().getArtifactId() ) )
{
- String structureReactorProject = getStructure( reactorProject );
+ String structureReactorProject = getStructure( reactorProject, false );
reactorProject.setUrl( outputRelativePath + "/" + structureReactorProject );
}
}
@@ -135,8 +138,8 @@
* @return the structure relative path
* @throws MojoExecutionException
*/
- private static String getStructure( MavenProject project )
- throws MojoExecutionException
+ private static String getStructure( MavenProject project, boolean ignoreMissingSiteUrl )
+ throws MojoExecutionException, MojoFailureException
{
if ( project.getDistributionManagement() == null )
{
@@ -155,13 +158,28 @@
Site site = project.getDistributionManagement().getSite();
if ( site == null )
{
- throw new MojoExecutionException(
- "Missing site information in the distribution management element in the project." );
+ if ( !ignoreMissingSiteUrl )
+ {
+ throw new MojoFailureException(
+ "Missing site information in the distribution management element in the project: '" +
+ project.getName() + "'." );
+ }
+ else
+ {
+ return null;
+ }
}
if ( StringUtils.isEmpty( site.getUrl() ) )
{
- throw new MojoExecutionException( "The URL in the site is missing in the project descriptor." );
+ if ( !ignoreMissingSiteUrl )
+ {
+ throw new MojoFailureException( "The URL in the site is missing in the project descriptor." );
+ }
+ else
+ {
+ return null;
+ }
}
Repository repository = new Repository( site.getId(), site.getUrl() );