You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2011/03/04 13:58:01 UTC

svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Author: ltheussl
Date: Fri Mar  4 12:58:01 2011
New Revision: 1077924

URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
Log:
refactor: re-use getSite() so we properly catch null values also in stage-deploy

Modified:
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Fri Mar  4 12:58:01 2011
@@ -26,6 +26,8 @@ import java.util.Locale;
 
 import org.apache.maven.artifact.manager.WagonConfigurationException;
 import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Site;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
@@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
 
         return parent;
     }
+
+    /**
+     * Extract the distributionManagment site from the given MavenProject.
+     *
+     * @param project the MavenProject. Not null.
+     *
+     * @return the project site. Not null.
+     *      Also site.getUrl() and site.getId() are guaranteed to be not null.
+     *
+     * @throws MojoExecutionException if any of the site info is missing.
+     */
+    protected static Site getSite( final MavenProject project )
+        throws MojoExecutionException
+    {
+        final String name = project.getName() + " ("
+            + project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion() + ")";
+
+        final DistributionManagement distributionManagement = project.getDistributionManagement();
+
+        if ( distributionManagement == null )
+        {
+            throw new MojoExecutionException( "Missing distribution management in project " + name );
+        }
+
+        final Site site = distributionManagement.getSite();
+
+        if ( site == null )
+        {
+            throw new MojoExecutionException(
+                "Missing site information in the distribution management of the project " + name );
+        }
+
+        if ( site.getUrl() == null || site.getId() == null )
+        {
+            throw new MojoExecutionException( "Missing site data: specify url and id for project " + name );
+        }
+
+        return site;
+    }
 }

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java Fri Mar  4 12:58:01 2011
@@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
  * under the License.
  */
 
-import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.model.Site;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
 
 /**
  * Deploys the generated site using <code>scp</code> or <code>file</code>
@@ -68,30 +66,4 @@ public class SiteDeployMojo
 
         return site.getUrl();
     }
-
-    private static Site getSite( final MavenProject project )
-        throws MojoExecutionException
-    {
-        final DistributionManagement distributionManagement = project.getDistributionManagement();
-
-        if ( distributionManagement == null )
-        {
-            throw new MojoExecutionException( "Missing distribution management information in the project." );
-        }
-
-        final Site site = distributionManagement.getSite();
-
-        if ( site == null )
-        {
-            throw new MojoExecutionException(
-                "Missing site information in the distribution management element in the project." );
-        }
-
-        if ( site.getUrl() == null || site.getId() == null )
-        {
-            throw new MojoExecutionException( "Missing site data for deploy: specify url and id!" );
-        }
-
-        return site;
-    }
 }

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java Fri Mar  4 12:58:01 2011
@@ -93,6 +93,7 @@ public class SiteStageDeployMojo
      * @return the site URL for staging
      */
     private String getStagingSiteURL( String usersStagingSiteURL )
+        throws MojoExecutionException
     {
         String topLevelURL = null;
 
@@ -106,7 +107,7 @@ public class SiteStageDeployMojo
         {
             // The user didn't specify a URL, use the top level target dir
             topLevelURL =
-                getTopLevelParent( project ).getDistributionManagement().getSite().getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
+                getSite( getTopLevelParent( project ) ).getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
             getLog().debug( "stagingSiteURL NOT specified, using the top level project: " + topLevelURL );
         }
 



Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Jeff Jensen <jj...@apache.org>.
Works great again... thank you Lukas! :-)


On Wed, Mar 9, 2011 at 2:04 PM, Lukas Theussl <lt...@apache.org> wrote:
>
> snapshots are deployed by now, let me know if it helps...
>
> -Lukas
>
>
> Jeff Jensen wrote:
>>
>> Thanks Lukas!  Sorry - haven't had a moment to get source and build it
>> (finishing features for prospect demo).  If you can get it deployed,
>> it will test itself though! :-)
>>
>>
>> On Tue, Mar 8, 2011 at 3:15 PM, Lukas Theussl<lt...@apache.org>  wrote:
>>>
>>> can you check if my last commits fixed it? However, you have to build it
>>> yourself as I'm getting a 500 when trying to deploy to apache right now,
>>> so
>>> no snaps are deployed yet.
>>>
>>> HTH,
>>> -Lukas
>>>
>>>
>>> Jeff Jensen wrote:
>>>>
>>>> Yes, :-)  3.0-beta-4-SNAPSHOT.  The fixes over the past months have
>>>> been very helpful, so I'm using the snapshot.
>>>>
>>>> Sorry for my wrong word choice; you correctly suggest the deploy part,
>>>> not site gen part.  I have a Hudson job that runs "mvn site-deploy
>>>> -e", so I accidentally combined the two phases as one "site gen".
>>>>
>>>> Stack trace from Hudson log:
>>>>
>>>> 08:23:15  [ERROR] Failed to execute goal
>>>> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
>>>> (default-deploy) on project yyy-parent: Missing site information in
>>>> the distribution management of the project Parent Maven POM
>>>> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT) ->    [Help 1]
>>>> 08:23:15  org.apache.maven.lifecycle.LifecycleExecutionException:
>>>> Failed to execute goal
>>>> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
>>>> (default-deploy) on project yyy-parent: Missing site information in
>>>> the distribution management of the project Parent Maven POM
>>>> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>>>> 08:23:15        at
>>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
>>>> 08:23:15        at
>>>> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>>>> 08:23:15        at
>>>> org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
>>>> 08:23:15        at
>>>> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>>>> 08:23:15        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>>>> 08:23:15        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>> 08:23:15        at
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> 08:23:15        at
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> 08:23:15        at java.lang.reflect.Method.invoke(Method.java:597)
>>>> 08:23:15        at
>>>>
>>>> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>>>> 08:23:15        at
>>>>
>>>> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>>>> 08:23:15        at
>>>>
>>>> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>>>> 08:23:15        at
>>>>
>>>> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>>>> 08:23:15  Caused by: org.apache.maven.plugin.MojoExecutionException:
>>>> Missing site information in the distribution management of the project
>>>> Parent Maven POM (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.plugins.site.AbstractDeployMojo.getSite(AbstractDeployMojo.java:701)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.plugins.site.SiteDeployMojo.getDeployRepositoryID(SiteDeployMojo.java:52)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.plugins.site.AbstractDeployMojo.execute(AbstractDeployMojo.java:155)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
>>>> 08:23:15        at
>>>>
>>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>>>> 08:23:15        ... 19 more
>>>>
>>>>
>>>> On Tue, Mar 8, 2011 at 1:18 PM, Lukas Theussl<lt...@apache.org>
>>>>  wrote:
>>>>>
>>>>> Hi Jeff,
>>>>>
>>>>> I deduce you are testing my current development version...?  ;)
>>>>>
>>>>> I don't see how this particular commit could have broken site
>>>>> generation
>>>>> as
>>>>> it only concerns the DeployMojo. However, I see that it could break
>>>>> site:stage-deploy, is this what you are seeing?
>>>>>
>>>>> I don't exclude that I broke something somewhere else, but I need more
>>>>> info
>>>>> to track it down, a stack trace or better a test project would help.
>>>>>
>>>>> Cheers,
>>>>> -Lukas
>>>>>
>>>>>
>>>>> Jeff Jensen wrote:
>>>>>>
>>>>>> Hi Lukas!
>>>>>>
>>>>>> I have a question on this commit, as it causes our site gen to now
>>>>>> fail.
>>>>>>
>>>>>> With the following change:
>>>>>>
>>>>>>> +        if ( site == null )
>>>>>>> +        {
>>>>>>> +            throw new MojoExecutionException(
>>>>>>> +                "Missing site information in the distribution
>>>>>>> management
>>>>>>> of the project " + name );
>>>>>>> +        }
>>>>>>
>>>>>> the following use case configuration encounters the above exception:
>>>>>>  - a project parent pom has a<distributionManagement><site>
>>>>>>  element
>>>>>> (modules of course inherit it)
>>>>>>  - a corporate parent pom does not have
>>>>>> a<distributionManagement><site>
>>>>>>  element
>>>>>>
>>>>>> We never run site gen for the corporate parent pom, so any
>>>>>> <distributionManagement><site>      element added will make it work
>>>>>> but is
>>>>>> unneeded/fake.
>>>>>>
>>>>>> So wondering if this configuration use case was considered and the
>>>>>> correct answer is to add a "fake"<site>      element to the corporate
>>>>>> parent or possibly this check for site definition needs tweaking (can
>>>>>> it consider the effective one?)?
>>>>>>
>>>>>>
>>>>>> On Fri, Mar 4, 2011 at 6:58 AM,<lt...@apache.org>      wrote:
>>>>>>>
>>>>>>> Author: ltheussl
>>>>>>> Date: Fri Mar  4 12:58:01 2011
>>>>>>> New Revision: 1077924
>>>>>>>
>>>>>>> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
>>>>>>> Log:
>>>>>>> refactor: re-use getSite() so we properly catch null values also in
>>>>>>> stage-deploy
>>>>>>>
>>>>>>> Modified:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>>>
>>>>>>> Modified:
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>>> URL:
>>>>>>>
>>>>>>>
>>>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>>> (original)
>>>>>>> +++
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>>> Fri Mar  4 12:58:01 2011
>>>>>>> @@ -26,6 +26,8 @@ import java.util.Locale;
>>>>>>>
>>>>>>>  import
>>>>>>> org.apache.maven.artifact.manager.WagonConfigurationException;
>>>>>>>  import org.apache.maven.artifact.manager.WagonManager;
>>>>>>> +import org.apache.maven.model.DistributionManagement;
>>>>>>> +import org.apache.maven.model.Site;
>>>>>>>  import org.apache.maven.plugin.MojoExecutionException;
>>>>>>>  import org.apache.maven.plugin.logging.Log;
>>>>>>>  import org.apache.maven.project.MavenProject;
>>>>>>> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>>>>>>>
>>>>>>>         return parent;
>>>>>>>     }
>>>>>>> +
>>>>>>> +    /**
>>>>>>> +     * Extract the distributionManagment site from the given
>>>>>>> MavenProject.
>>>>>>> +     *
>>>>>>> +     * @param project the MavenProject. Not null.
>>>>>>> +     *
>>>>>>> +     * @return the project site. Not null.
>>>>>>> +     *      Also site.getUrl() and site.getId() are guaranteed to be
>>>>>>> not
>>>>>>> null.
>>>>>>> +     *
>>>>>>> +     * @throws MojoExecutionException if any of the site info is
>>>>>>> missing.
>>>>>>> +     */
>>>>>>> +    protected static Site getSite( final MavenProject project )
>>>>>>> +        throws MojoExecutionException
>>>>>>> +    {
>>>>>>> +        final String name = project.getName() + " ("
>>>>>>> +            + project.getGroupId() + ":" + project.getArtifactId() +
>>>>>>> ":"
>>>>>>> + project.getVersion() + ")";
>>>>>>> +
>>>>>>> +        final DistributionManagement distributionManagement =
>>>>>>> project.getDistributionManagement();
>>>>>>> +
>>>>>>> +        if ( distributionManagement == null )
>>>>>>> +        {
>>>>>>> +            throw new MojoExecutionException( "Missing distribution
>>>>>>> management in project " + name );
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        final Site site = distributionManagement.getSite();
>>>>>>> +
>>>>>>> +        if ( site == null )
>>>>>>> +        {
>>>>>>> +            throw new MojoExecutionException(
>>>>>>> +                "Missing site information in the distribution
>>>>>>> management
>>>>>>> of the project " + name );
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        if ( site.getUrl() == null || site.getId() == null )
>>>>>>> +        {
>>>>>>> +            throw new MojoExecutionException( "Missing site data:
>>>>>>> specify url and id for project " + name );
>>>>>>> +        }
>>>>>>> +
>>>>>>> +        return site;
>>>>>>> +    }
>>>>>>>  }
>>>>>>>
>>>>>>> Modified:
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>>> URL:
>>>>>>>
>>>>>>>
>>>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>>> (original)
>>>>>>> +++
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>>> Fri Mar  4 12:58:01 2011
>>>>>>> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>>>>>>>  * under the License.
>>>>>>>  */
>>>>>>>
>>>>>>> -import org.apache.maven.model.DistributionManagement;
>>>>>>>  import org.apache.maven.model.Site;
>>>>>>>  import org.apache.maven.plugin.MojoExecutionException;
>>>>>>> -import org.apache.maven.project.MavenProject;
>>>>>>>
>>>>>>>  /**
>>>>>>>  * Deploys the generated site using<code>scp</code>
>>>>>>>  or<code>file</code>
>>>>>>> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>>>>>>>
>>>>>>>         return site.getUrl();
>>>>>>>     }
>>>>>>> -
>>>>>>> -    private static Site getSite( final MavenProject project )
>>>>>>> -        throws MojoExecutionException
>>>>>>> -    {
>>>>>>> -        final DistributionManagement distributionManagement =
>>>>>>> project.getDistributionManagement();
>>>>>>> -
>>>>>>> -        if ( distributionManagement == null )
>>>>>>> -        {
>>>>>>> -            throw new MojoExecutionException( "Missing distribution
>>>>>>> management information in the project." );
>>>>>>> -        }
>>>>>>> -
>>>>>>> -        final Site site = distributionManagement.getSite();
>>>>>>> -
>>>>>>> -        if ( site == null )
>>>>>>> -        {
>>>>>>> -            throw new MojoExecutionException(
>>>>>>> -                "Missing site information in the distribution
>>>>>>> management
>>>>>>> element in the project." );
>>>>>>> -        }
>>>>>>> -
>>>>>>> -        if ( site.getUrl() == null || site.getId() == null )
>>>>>>> -        {
>>>>>>> -            throw new MojoExecutionException( "Missing site data for
>>>>>>> deploy: specify url and id!" );
>>>>>>> -        }
>>>>>>> -
>>>>>>> -        return site;
>>>>>>> -    }
>>>>>>>  }
>>>>>>>
>>>>>>> Modified:
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>>> URL:
>>>>>>>
>>>>>>>
>>>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>>> (original)
>>>>>>> +++
>>>>>>>
>>>>>>>
>>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>>> Fri Mar  4 12:58:01 2011
>>>>>>> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>>>>>>>      * @return the site URL for staging
>>>>>>>      */
>>>>>>>     private String getStagingSiteURL( String usersStagingSiteURL )
>>>>>>> +        throws MojoExecutionException
>>>>>>>     {
>>>>>>>         String topLevelURL = null;
>>>>>>>
>>>>>>> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>>>>>>>         {
>>>>>>>             // The user didn't specify a URL, use the top level
>>>>>>> target
>>>>>>> dir
>>>>>>>             topLevelURL =
>>>>>>> -                getTopLevelParent( project
>>>>>>> ).getDistributionManagement().getSite().getUrl() + "/" +
>>>>>>> DEFAULT_STAGING_DIRECTORY;
>>>>>>> +                getSite( getTopLevelParent( project ) ).getUrl() +
>>>>>>> "/"
>>>>>>> +
>>>>>>> DEFAULT_STAGING_DIRECTORY;
>>>>>>>             getLog().debug( "stagingSiteURL NOT specified, using the
>>>>>>> top
>>>>>>> level project: " + topLevelURL );
>>>>>>>         }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Lukas Theussl <lt...@apache.org>.
snapshots are deployed by now, let me know if it helps...

-Lukas


Jeff Jensen wrote:
> Thanks Lukas!  Sorry - haven't had a moment to get source and build it
> (finishing features for prospect demo).  If you can get it deployed,
> it will test itself though! :-)
>
>
> On Tue, Mar 8, 2011 at 3:15 PM, Lukas Theussl<lt...@apache.org>  wrote:
>>
>> can you check if my last commits fixed it? However, you have to build it
>> yourself as I'm getting a 500 when trying to deploy to apache right now, so
>> no snaps are deployed yet.
>>
>> HTH,
>> -Lukas
>>
>>
>> Jeff Jensen wrote:
>>>
>>> Yes, :-)  3.0-beta-4-SNAPSHOT.  The fixes over the past months have
>>> been very helpful, so I'm using the snapshot.
>>>
>>> Sorry for my wrong word choice; you correctly suggest the deploy part,
>>> not site gen part.  I have a Hudson job that runs "mvn site-deploy
>>> -e", so I accidentally combined the two phases as one "site gen".
>>>
>>> Stack trace from Hudson log:
>>>
>>> 08:23:15  [ERROR] Failed to execute goal
>>> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
>>> (default-deploy) on project yyy-parent: Missing site information in
>>> the distribution management of the project Parent Maven POM
>>> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT) ->    [Help 1]
>>> 08:23:15  org.apache.maven.lifecycle.LifecycleExecutionException:
>>> Failed to execute goal
>>> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
>>> (default-deploy) on project yyy-parent: Missing site information in
>>> the distribution management of the project Parent Maven POM
>>> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>>> 08:23:15        at
>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
>>> 08:23:15        at
>>> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>>> 08:23:15        at
>>> org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
>>> 08:23:15        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>>> 08:23:15        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>>> 08:23:15        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)
>>> 08:23:15        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> 08:23:15        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> 08:23:15        at java.lang.reflect.Method.invoke(Method.java:597)
>>> 08:23:15        at
>>> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>>> 08:23:15        at
>>> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>>> 08:23:15        at
>>> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>>> 08:23:15        at
>>> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>>> 08:23:15  Caused by: org.apache.maven.plugin.MojoExecutionException:
>>> Missing site information in the distribution management of the project
>>> Parent Maven POM (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
>>> 08:23:15        at
>>> org.apache.maven.plugins.site.AbstractDeployMojo.getSite(AbstractDeployMojo.java:701)
>>> 08:23:15        at
>>> org.apache.maven.plugins.site.SiteDeployMojo.getDeployRepositoryID(SiteDeployMojo.java:52)
>>> 08:23:15        at
>>> org.apache.maven.plugins.site.AbstractDeployMojo.execute(AbstractDeployMojo.java:155)
>>> 08:23:15        at
>>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
>>> 08:23:15        at
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>>> 08:23:15        ... 19 more
>>>
>>>
>>> On Tue, Mar 8, 2011 at 1:18 PM, Lukas Theussl<lt...@apache.org>    wrote:
>>>>
>>>> Hi Jeff,
>>>>
>>>> I deduce you are testing my current development version...?  ;)
>>>>
>>>> I don't see how this particular commit could have broken site generation
>>>> as
>>>> it only concerns the DeployMojo. However, I see that it could break
>>>> site:stage-deploy, is this what you are seeing?
>>>>
>>>> I don't exclude that I broke something somewhere else, but I need more
>>>> info
>>>> to track it down, a stack trace or better a test project would help.
>>>>
>>>> Cheers,
>>>> -Lukas
>>>>
>>>>
>>>> Jeff Jensen wrote:
>>>>>
>>>>> Hi Lukas!
>>>>>
>>>>> I have a question on this commit, as it causes our site gen to now fail.
>>>>>
>>>>> With the following change:
>>>>>
>>>>>> +        if ( site == null )
>>>>>> +        {
>>>>>> +            throw new MojoExecutionException(
>>>>>> +                "Missing site information in the distribution
>>>>>> management
>>>>>> of the project " + name );
>>>>>> +        }
>>>>>
>>>>> the following use case configuration encounters the above exception:
>>>>>   - a project parent pom has a<distributionManagement><site>      element
>>>>> (modules of course inherit it)
>>>>>   - a corporate parent pom does not have a<distributionManagement><site>
>>>>>   element
>>>>>
>>>>> We never run site gen for the corporate parent pom, so any
>>>>> <distributionManagement><site>      element added will make it work but is
>>>>> unneeded/fake.
>>>>>
>>>>> So wondering if this configuration use case was considered and the
>>>>> correct answer is to add a "fake"<site>      element to the corporate
>>>>> parent or possibly this check for site definition needs tweaking (can
>>>>> it consider the effective one?)?
>>>>>
>>>>>
>>>>> On Fri, Mar 4, 2011 at 6:58 AM,<lt...@apache.org>      wrote:
>>>>>>
>>>>>> Author: ltheussl
>>>>>> Date: Fri Mar  4 12:58:01 2011
>>>>>> New Revision: 1077924
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
>>>>>> Log:
>>>>>> refactor: re-use getSite() so we properly catch null values also in
>>>>>> stage-deploy
>>>>>>
>>>>>> Modified:
>>>>>>
>>>>>>
>>>>>>   maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>>
>>>>>>
>>>>>>   maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>>
>>>>>>
>>>>>>   maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>>
>>>>>> Modified:
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>> URL:
>>>>>>
>>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>>
>>>>>>
>>>>>> ==============================================================================
>>>>>> ---
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>> (original)
>>>>>> +++
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>> Fri Mar  4 12:58:01 2011
>>>>>> @@ -26,6 +26,8 @@ import java.util.Locale;
>>>>>>
>>>>>>   import org.apache.maven.artifact.manager.WagonConfigurationException;
>>>>>>   import org.apache.maven.artifact.manager.WagonManager;
>>>>>> +import org.apache.maven.model.DistributionManagement;
>>>>>> +import org.apache.maven.model.Site;
>>>>>>   import org.apache.maven.plugin.MojoExecutionException;
>>>>>>   import org.apache.maven.plugin.logging.Log;
>>>>>>   import org.apache.maven.project.MavenProject;
>>>>>> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>>>>>>
>>>>>>          return parent;
>>>>>>      }
>>>>>> +
>>>>>> +    /**
>>>>>> +     * Extract the distributionManagment site from the given
>>>>>> MavenProject.
>>>>>> +     *
>>>>>> +     * @param project the MavenProject. Not null.
>>>>>> +     *
>>>>>> +     * @return the project site. Not null.
>>>>>> +     *      Also site.getUrl() and site.getId() are guaranteed to be
>>>>>> not
>>>>>> null.
>>>>>> +     *
>>>>>> +     * @throws MojoExecutionException if any of the site info is
>>>>>> missing.
>>>>>> +     */
>>>>>> +    protected static Site getSite( final MavenProject project )
>>>>>> +        throws MojoExecutionException
>>>>>> +    {
>>>>>> +        final String name = project.getName() + " ("
>>>>>> +            + project.getGroupId() + ":" + project.getArtifactId() +
>>>>>> ":"
>>>>>> + project.getVersion() + ")";
>>>>>> +
>>>>>> +        final DistributionManagement distributionManagement =
>>>>>> project.getDistributionManagement();
>>>>>> +
>>>>>> +        if ( distributionManagement == null )
>>>>>> +        {
>>>>>> +            throw new MojoExecutionException( "Missing distribution
>>>>>> management in project " + name );
>>>>>> +        }
>>>>>> +
>>>>>> +        final Site site = distributionManagement.getSite();
>>>>>> +
>>>>>> +        if ( site == null )
>>>>>> +        {
>>>>>> +            throw new MojoExecutionException(
>>>>>> +                "Missing site information in the distribution
>>>>>> management
>>>>>> of the project " + name );
>>>>>> +        }
>>>>>> +
>>>>>> +        if ( site.getUrl() == null || site.getId() == null )
>>>>>> +        {
>>>>>> +            throw new MojoExecutionException( "Missing site data:
>>>>>> specify url and id for project " + name );
>>>>>> +        }
>>>>>> +
>>>>>> +        return site;
>>>>>> +    }
>>>>>>   }
>>>>>>
>>>>>> Modified:
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>> URL:
>>>>>>
>>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>>
>>>>>>
>>>>>> ==============================================================================
>>>>>> ---
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>> (original)
>>>>>> +++
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>> Fri Mar  4 12:58:01 2011
>>>>>> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>>>>>>   * under the License.
>>>>>>   */
>>>>>>
>>>>>> -import org.apache.maven.model.DistributionManagement;
>>>>>>   import org.apache.maven.model.Site;
>>>>>>   import org.apache.maven.plugin.MojoExecutionException;
>>>>>> -import org.apache.maven.project.MavenProject;
>>>>>>
>>>>>>   /**
>>>>>>   * Deploys the generated site using<code>scp</code>
>>>>>>   or<code>file</code>
>>>>>> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>>>>>>
>>>>>>          return site.getUrl();
>>>>>>      }
>>>>>> -
>>>>>> -    private static Site getSite( final MavenProject project )
>>>>>> -        throws MojoExecutionException
>>>>>> -    {
>>>>>> -        final DistributionManagement distributionManagement =
>>>>>> project.getDistributionManagement();
>>>>>> -
>>>>>> -        if ( distributionManagement == null )
>>>>>> -        {
>>>>>> -            throw new MojoExecutionException( "Missing distribution
>>>>>> management information in the project." );
>>>>>> -        }
>>>>>> -
>>>>>> -        final Site site = distributionManagement.getSite();
>>>>>> -
>>>>>> -        if ( site == null )
>>>>>> -        {
>>>>>> -            throw new MojoExecutionException(
>>>>>> -                "Missing site information in the distribution
>>>>>> management
>>>>>> element in the project." );
>>>>>> -        }
>>>>>> -
>>>>>> -        if ( site.getUrl() == null || site.getId() == null )
>>>>>> -        {
>>>>>> -            throw new MojoExecutionException( "Missing site data for
>>>>>> deploy: specify url and id!" );
>>>>>> -        }
>>>>>> -
>>>>>> -        return site;
>>>>>> -    }
>>>>>>   }
>>>>>>
>>>>>> Modified:
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>> URL:
>>>>>>
>>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>>
>>>>>>
>>>>>> ==============================================================================
>>>>>> ---
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>> (original)
>>>>>> +++
>>>>>>
>>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>> Fri Mar  4 12:58:01 2011
>>>>>> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>>>>>>       * @return the site URL for staging
>>>>>>       */
>>>>>>      private String getStagingSiteURL( String usersStagingSiteURL )
>>>>>> +        throws MojoExecutionException
>>>>>>      {
>>>>>>          String topLevelURL = null;
>>>>>>
>>>>>> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>>>>>>          {
>>>>>>              // The user didn't specify a URL, use the top level target
>>>>>> dir
>>>>>>              topLevelURL =
>>>>>> -                getTopLevelParent( project
>>>>>> ).getDistributionManagement().getSite().getUrl() + "/" +
>>>>>> DEFAULT_STAGING_DIRECTORY;
>>>>>> +                getSite( getTopLevelParent( project ) ).getUrl() + "/"
>>>>>> +
>>>>>> DEFAULT_STAGING_DIRECTORY;
>>>>>>              getLog().debug( "stagingSiteURL NOT specified, using the
>>>>>> top
>>>>>> level project: " + topLevelURL );
>>>>>>          }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Jeff Jensen <jj...@apache.org>.
Thanks Lukas!  Sorry - haven't had a moment to get source and build it
(finishing features for prospect demo).  If you can get it deployed,
it will test itself though! :-)


On Tue, Mar 8, 2011 at 3:15 PM, Lukas Theussl <lt...@apache.org> wrote:
>
> can you check if my last commits fixed it? However, you have to build it
> yourself as I'm getting a 500 when trying to deploy to apache right now, so
> no snaps are deployed yet.
>
> HTH,
> -Lukas
>
>
> Jeff Jensen wrote:
>>
>> Yes, :-)  3.0-beta-4-SNAPSHOT.  The fixes over the past months have
>> been very helpful, so I'm using the snapshot.
>>
>> Sorry for my wrong word choice; you correctly suggest the deploy part,
>> not site gen part.  I have a Hudson job that runs "mvn site-deploy
>> -e", so I accidentally combined the two phases as one "site gen".
>>
>> Stack trace from Hudson log:
>>
>> 08:23:15  [ERROR] Failed to execute goal
>> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
>> (default-deploy) on project yyy-parent: Missing site information in
>> the distribution management of the project Parent Maven POM
>> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT) ->  [Help 1]
>> 08:23:15  org.apache.maven.lifecycle.LifecycleExecutionException:
>> Failed to execute goal
>> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
>> (default-deploy) on project yyy-parent: Missing site information in
>> the distribution management of the project Parent Maven POM
>> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>> 08:23:15        at
>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
>> 08:23:15        at
>> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>> 08:23:15        at
>> org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
>> 08:23:15        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>> 08:23:15        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>> 08:23:15        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>> 08:23:15        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 08:23:15        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 08:23:15        at java.lang.reflect.Method.invoke(Method.java:597)
>> 08:23:15        at
>> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>> 08:23:15        at
>> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>> 08:23:15        at
>> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>> 08:23:15        at
>> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>> 08:23:15  Caused by: org.apache.maven.plugin.MojoExecutionException:
>> Missing site information in the distribution management of the project
>> Parent Maven POM (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
>> 08:23:15        at
>> org.apache.maven.plugins.site.AbstractDeployMojo.getSite(AbstractDeployMojo.java:701)
>> 08:23:15        at
>> org.apache.maven.plugins.site.SiteDeployMojo.getDeployRepositoryID(SiteDeployMojo.java:52)
>> 08:23:15        at
>> org.apache.maven.plugins.site.AbstractDeployMojo.execute(AbstractDeployMojo.java:155)
>> 08:23:15        at
>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
>> 08:23:15        at
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>> 08:23:15        ... 19 more
>>
>>
>> On Tue, Mar 8, 2011 at 1:18 PM, Lukas Theussl<lt...@apache.org>  wrote:
>>>
>>> Hi Jeff,
>>>
>>> I deduce you are testing my current development version...?  ;)
>>>
>>> I don't see how this particular commit could have broken site generation
>>> as
>>> it only concerns the DeployMojo. However, I see that it could break
>>> site:stage-deploy, is this what you are seeing?
>>>
>>> I don't exclude that I broke something somewhere else, but I need more
>>> info
>>> to track it down, a stack trace or better a test project would help.
>>>
>>> Cheers,
>>> -Lukas
>>>
>>>
>>> Jeff Jensen wrote:
>>>>
>>>> Hi Lukas!
>>>>
>>>> I have a question on this commit, as it causes our site gen to now fail.
>>>>
>>>> With the following change:
>>>>
>>>>> +        if ( site == null )
>>>>> +        {
>>>>> +            throw new MojoExecutionException(
>>>>> +                "Missing site information in the distribution
>>>>> management
>>>>> of the project " + name );
>>>>> +        }
>>>>
>>>> the following use case configuration encounters the above exception:
>>>>  - a project parent pom has a<distributionManagement><site>    element
>>>> (modules of course inherit it)
>>>>  - a corporate parent pom does not have a<distributionManagement><site>
>>>>  element
>>>>
>>>> We never run site gen for the corporate parent pom, so any
>>>> <distributionManagement><site>    element added will make it work but is
>>>> unneeded/fake.
>>>>
>>>> So wondering if this configuration use case was considered and the
>>>> correct answer is to add a "fake"<site>    element to the corporate
>>>> parent or possibly this check for site definition needs tweaking (can
>>>> it consider the effective one?)?
>>>>
>>>>
>>>> On Fri, Mar 4, 2011 at 6:58 AM,<lt...@apache.org>    wrote:
>>>>>
>>>>> Author: ltheussl
>>>>> Date: Fri Mar  4 12:58:01 2011
>>>>> New Revision: 1077924
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
>>>>> Log:
>>>>> refactor: re-use getSite() so we properly catch null values also in
>>>>> stage-deploy
>>>>>
>>>>> Modified:
>>>>>
>>>>>
>>>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>>
>>>>>
>>>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>>
>>>>>
>>>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>>
>>>>> Modified:
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>> URL:
>>>>>
>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>
>>>>>
>>>>> ==============================================================================
>>>>> ---
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>> (original)
>>>>> +++
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>> Fri Mar  4 12:58:01 2011
>>>>> @@ -26,6 +26,8 @@ import java.util.Locale;
>>>>>
>>>>>  import org.apache.maven.artifact.manager.WagonConfigurationException;
>>>>>  import org.apache.maven.artifact.manager.WagonManager;
>>>>> +import org.apache.maven.model.DistributionManagement;
>>>>> +import org.apache.maven.model.Site;
>>>>>  import org.apache.maven.plugin.MojoExecutionException;
>>>>>  import org.apache.maven.plugin.logging.Log;
>>>>>  import org.apache.maven.project.MavenProject;
>>>>> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>>>>>
>>>>>         return parent;
>>>>>     }
>>>>> +
>>>>> +    /**
>>>>> +     * Extract the distributionManagment site from the given
>>>>> MavenProject.
>>>>> +     *
>>>>> +     * @param project the MavenProject. Not null.
>>>>> +     *
>>>>> +     * @return the project site. Not null.
>>>>> +     *      Also site.getUrl() and site.getId() are guaranteed to be
>>>>> not
>>>>> null.
>>>>> +     *
>>>>> +     * @throws MojoExecutionException if any of the site info is
>>>>> missing.
>>>>> +     */
>>>>> +    protected static Site getSite( final MavenProject project )
>>>>> +        throws MojoExecutionException
>>>>> +    {
>>>>> +        final String name = project.getName() + " ("
>>>>> +            + project.getGroupId() + ":" + project.getArtifactId() +
>>>>> ":"
>>>>> + project.getVersion() + ")";
>>>>> +
>>>>> +        final DistributionManagement distributionManagement =
>>>>> project.getDistributionManagement();
>>>>> +
>>>>> +        if ( distributionManagement == null )
>>>>> +        {
>>>>> +            throw new MojoExecutionException( "Missing distribution
>>>>> management in project " + name );
>>>>> +        }
>>>>> +
>>>>> +        final Site site = distributionManagement.getSite();
>>>>> +
>>>>> +        if ( site == null )
>>>>> +        {
>>>>> +            throw new MojoExecutionException(
>>>>> +                "Missing site information in the distribution
>>>>> management
>>>>> of the project " + name );
>>>>> +        }
>>>>> +
>>>>> +        if ( site.getUrl() == null || site.getId() == null )
>>>>> +        {
>>>>> +            throw new MojoExecutionException( "Missing site data:
>>>>> specify url and id for project " + name );
>>>>> +        }
>>>>> +
>>>>> +        return site;
>>>>> +    }
>>>>>  }
>>>>>
>>>>> Modified:
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>> URL:
>>>>>
>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>
>>>>>
>>>>> ==============================================================================
>>>>> ---
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>> (original)
>>>>> +++
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>> Fri Mar  4 12:58:01 2011
>>>>> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>>>>>  * under the License.
>>>>>  */
>>>>>
>>>>> -import org.apache.maven.model.DistributionManagement;
>>>>>  import org.apache.maven.model.Site;
>>>>>  import org.apache.maven.plugin.MojoExecutionException;
>>>>> -import org.apache.maven.project.MavenProject;
>>>>>
>>>>>  /**
>>>>>  * Deploys the generated site using<code>scp</code>
>>>>>  or<code>file</code>
>>>>> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>>>>>
>>>>>         return site.getUrl();
>>>>>     }
>>>>> -
>>>>> -    private static Site getSite( final MavenProject project )
>>>>> -        throws MojoExecutionException
>>>>> -    {
>>>>> -        final DistributionManagement distributionManagement =
>>>>> project.getDistributionManagement();
>>>>> -
>>>>> -        if ( distributionManagement == null )
>>>>> -        {
>>>>> -            throw new MojoExecutionException( "Missing distribution
>>>>> management information in the project." );
>>>>> -        }
>>>>> -
>>>>> -        final Site site = distributionManagement.getSite();
>>>>> -
>>>>> -        if ( site == null )
>>>>> -        {
>>>>> -            throw new MojoExecutionException(
>>>>> -                "Missing site information in the distribution
>>>>> management
>>>>> element in the project." );
>>>>> -        }
>>>>> -
>>>>> -        if ( site.getUrl() == null || site.getId() == null )
>>>>> -        {
>>>>> -            throw new MojoExecutionException( "Missing site data for
>>>>> deploy: specify url and id!" );
>>>>> -        }
>>>>> -
>>>>> -        return site;
>>>>> -    }
>>>>>  }
>>>>>
>>>>> Modified:
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>> URL:
>>>>>
>>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>>
>>>>>
>>>>> ==============================================================================
>>>>> ---
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>> (original)
>>>>> +++
>>>>>
>>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>> Fri Mar  4 12:58:01 2011
>>>>> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>>>>>      * @return the site URL for staging
>>>>>      */
>>>>>     private String getStagingSiteURL( String usersStagingSiteURL )
>>>>> +        throws MojoExecutionException
>>>>>     {
>>>>>         String topLevelURL = null;
>>>>>
>>>>> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>>>>>         {
>>>>>             // The user didn't specify a URL, use the top level target
>>>>> dir
>>>>>             topLevelURL =
>>>>> -                getTopLevelParent( project
>>>>> ).getDistributionManagement().getSite().getUrl() + "/" +
>>>>> DEFAULT_STAGING_DIRECTORY;
>>>>> +                getSite( getTopLevelParent( project ) ).getUrl() + "/"
>>>>> +
>>>>> DEFAULT_STAGING_DIRECTORY;
>>>>>             getLog().debug( "stagingSiteURL NOT specified, using the
>>>>> top
>>>>> level project: " + topLevelURL );
>>>>>         }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Lukas Theussl <lt...@apache.org>.
can you check if my last commits fixed it? However, you have to build it 
yourself as I'm getting a 500 when trying to deploy to apache right now, 
so no snaps are deployed yet.

HTH,
-Lukas


Jeff Jensen wrote:
> Yes, :-)  3.0-beta-4-SNAPSHOT.  The fixes over the past months have
> been very helpful, so I'm using the snapshot.
>
> Sorry for my wrong word choice; you correctly suggest the deploy part,
> not site gen part.  I have a Hudson job that runs "mvn site-deploy
> -e", so I accidentally combined the two phases as one "site gen".
>
> Stack trace from Hudson log:
>
> 08:23:15  [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
> (default-deploy) on project yyy-parent: Missing site information in
> the distribution management of the project Parent Maven POM
> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT) ->  [Help 1]
> 08:23:15  org.apache.maven.lifecycle.LifecycleExecutionException:
> Failed to execute goal
> org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
> (default-deploy) on project yyy-parent: Missing site information in
> the distribution management of the project Parent Maven POM
> (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
> 08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
> 08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> 08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> 08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> 08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> 08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> 08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> 08:23:15  	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
> 08:23:15  	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> 08:23:15  	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
> 08:23:15  	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> 08:23:15  	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> 08:23:15  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 08:23:15  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 08:23:15  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 08:23:15  	at java.lang.reflect.Method.invoke(Method.java:597)
> 08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> 08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> 08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> 08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> 08:23:15  Caused by: org.apache.maven.plugin.MojoExecutionException:
> Missing site information in the distribution management of the project
> Parent Maven POM (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
> 08:23:15  	at org.apache.maven.plugins.site.AbstractDeployMojo.getSite(AbstractDeployMojo.java:701)
> 08:23:15  	at org.apache.maven.plugins.site.SiteDeployMojo.getDeployRepositoryID(SiteDeployMojo.java:52)
> 08:23:15  	at org.apache.maven.plugins.site.AbstractDeployMojo.execute(AbstractDeployMojo.java:155)
> 08:23:15  	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
> 08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> 08:23:15  	... 19 more
>
>
> On Tue, Mar 8, 2011 at 1:18 PM, Lukas Theussl<lt...@apache.org>  wrote:
>>
>> Hi Jeff,
>>
>> I deduce you are testing my current development version...?  ;)
>>
>> I don't see how this particular commit could have broken site generation as
>> it only concerns the DeployMojo. However, I see that it could break
>> site:stage-deploy, is this what you are seeing?
>>
>> I don't exclude that I broke something somewhere else, but I need more info
>> to track it down, a stack trace or better a test project would help.
>>
>> Cheers,
>> -Lukas
>>
>>
>> Jeff Jensen wrote:
>>>
>>> Hi Lukas!
>>>
>>> I have a question on this commit, as it causes our site gen to now fail.
>>>
>>> With the following change:
>>>
>>>> +        if ( site == null )
>>>> +        {
>>>> +            throw new MojoExecutionException(
>>>> +                "Missing site information in the distribution management
>>>> of the project " + name );
>>>> +        }
>>>
>>> the following use case configuration encounters the above exception:
>>>   - a project parent pom has a<distributionManagement><site>    element
>>> (modules of course inherit it)
>>>   - a corporate parent pom does not have a<distributionManagement><site>
>>>   element
>>>
>>> We never run site gen for the corporate parent pom, so any
>>> <distributionManagement><site>    element added will make it work but is
>>> unneeded/fake.
>>>
>>> So wondering if this configuration use case was considered and the
>>> correct answer is to add a "fake"<site>    element to the corporate
>>> parent or possibly this check for site definition needs tweaking (can
>>> it consider the effective one?)?
>>>
>>>
>>> On Fri, Mar 4, 2011 at 6:58 AM,<lt...@apache.org>    wrote:
>>>>
>>>> Author: ltheussl
>>>> Date: Fri Mar  4 12:58:01 2011
>>>> New Revision: 1077924
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
>>>> Log:
>>>> refactor: re-use getSite() so we properly catch null values also in
>>>> stage-deploy
>>>>
>>>> Modified:
>>>>
>>>>   maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>>
>>>>   maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>>
>>>>   maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>>
>>>> Modified:
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>> (original)
>>>> +++
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>> Fri Mar  4 12:58:01 2011
>>>> @@ -26,6 +26,8 @@ import java.util.Locale;
>>>>
>>>>   import org.apache.maven.artifact.manager.WagonConfigurationException;
>>>>   import org.apache.maven.artifact.manager.WagonManager;
>>>> +import org.apache.maven.model.DistributionManagement;
>>>> +import org.apache.maven.model.Site;
>>>>   import org.apache.maven.plugin.MojoExecutionException;
>>>>   import org.apache.maven.plugin.logging.Log;
>>>>   import org.apache.maven.project.MavenProject;
>>>> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>>>>
>>>>          return parent;
>>>>      }
>>>> +
>>>> +    /**
>>>> +     * Extract the distributionManagment site from the given
>>>> MavenProject.
>>>> +     *
>>>> +     * @param project the MavenProject. Not null.
>>>> +     *
>>>> +     * @return the project site. Not null.
>>>> +     *      Also site.getUrl() and site.getId() are guaranteed to be not
>>>> null.
>>>> +     *
>>>> +     * @throws MojoExecutionException if any of the site info is
>>>> missing.
>>>> +     */
>>>> +    protected static Site getSite( final MavenProject project )
>>>> +        throws MojoExecutionException
>>>> +    {
>>>> +        final String name = project.getName() + " ("
>>>> +            + project.getGroupId() + ":" + project.getArtifactId() + ":"
>>>> + project.getVersion() + ")";
>>>> +
>>>> +        final DistributionManagement distributionManagement =
>>>> project.getDistributionManagement();
>>>> +
>>>> +        if ( distributionManagement == null )
>>>> +        {
>>>> +            throw new MojoExecutionException( "Missing distribution
>>>> management in project " + name );
>>>> +        }
>>>> +
>>>> +        final Site site = distributionManagement.getSite();
>>>> +
>>>> +        if ( site == null )
>>>> +        {
>>>> +            throw new MojoExecutionException(
>>>> +                "Missing site information in the distribution management
>>>> of the project " + name );
>>>> +        }
>>>> +
>>>> +        if ( site.getUrl() == null || site.getId() == null )
>>>> +        {
>>>> +            throw new MojoExecutionException( "Missing site data:
>>>> specify url and id for project " + name );
>>>> +        }
>>>> +
>>>> +        return site;
>>>> +    }
>>>>   }
>>>>
>>>> Modified:
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>> (original)
>>>> +++
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>> Fri Mar  4 12:58:01 2011
>>>> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>>>>   * under the License.
>>>>   */
>>>>
>>>> -import org.apache.maven.model.DistributionManagement;
>>>>   import org.apache.maven.model.Site;
>>>>   import org.apache.maven.plugin.MojoExecutionException;
>>>> -import org.apache.maven.project.MavenProject;
>>>>
>>>>   /**
>>>>   * Deploys the generated site using<code>scp</code>    or<code>file</code>
>>>> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>>>>
>>>>          return site.getUrl();
>>>>      }
>>>> -
>>>> -    private static Site getSite( final MavenProject project )
>>>> -        throws MojoExecutionException
>>>> -    {
>>>> -        final DistributionManagement distributionManagement =
>>>> project.getDistributionManagement();
>>>> -
>>>> -        if ( distributionManagement == null )
>>>> -        {
>>>> -            throw new MojoExecutionException( "Missing distribution
>>>> management information in the project." );
>>>> -        }
>>>> -
>>>> -        final Site site = distributionManagement.getSite();
>>>> -
>>>> -        if ( site == null )
>>>> -        {
>>>> -            throw new MojoExecutionException(
>>>> -                "Missing site information in the distribution management
>>>> element in the project." );
>>>> -        }
>>>> -
>>>> -        if ( site.getUrl() == null || site.getId() == null )
>>>> -        {
>>>> -            throw new MojoExecutionException( "Missing site data for
>>>> deploy: specify url and id!" );
>>>> -        }
>>>> -
>>>> -        return site;
>>>> -    }
>>>>   }
>>>>
>>>> Modified:
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>> (original)
>>>> +++
>>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>> Fri Mar  4 12:58:01 2011
>>>> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>>>>       * @return the site URL for staging
>>>>       */
>>>>      private String getStagingSiteURL( String usersStagingSiteURL )
>>>> +        throws MojoExecutionException
>>>>      {
>>>>          String topLevelURL = null;
>>>>
>>>> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>>>>          {
>>>>              // The user didn't specify a URL, use the top level target
>>>> dir
>>>>              topLevelURL =
>>>> -                getTopLevelParent( project
>>>> ).getDistributionManagement().getSite().getUrl() + "/" +
>>>> DEFAULT_STAGING_DIRECTORY;
>>>> +                getSite( getTopLevelParent( project ) ).getUrl() + "/" +
>>>> DEFAULT_STAGING_DIRECTORY;
>>>>              getLog().debug( "stagingSiteURL NOT specified, using the top
>>>> level project: " + topLevelURL );
>>>>          }
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Jeff Jensen <je...@upstairstechnology.com>.
Yes, :-)  3.0-beta-4-SNAPSHOT.  The fixes over the past months have
been very helpful, so I'm using the snapshot.

Sorry for my wrong word choice; you correctly suggest the deploy part,
not site gen part.  I have a Hudson job that runs "mvn site-deploy
-e", so I accidentally combined the two phases as one "site gen".

Stack trace from Hudson log:

08:23:15  [ERROR] Failed to execute goal
org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
(default-deploy) on project yyy-parent: Missing site information in
the distribution management of the project Parent Maven POM
(com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT) -> [Help 1]
08:23:15  org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal
org.apache.maven.plugins:maven-site-plugin:3.0-beta-4-SNAPSHOT:deploy
(default-deploy) on project yyy-parent: Missing site information in
the distribution management of the project Parent Maven POM
(com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
08:23:15  	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
08:23:15  	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
08:23:15  	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
08:23:15  	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
08:23:15  	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
08:23:15  	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
08:23:15  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
08:23:15  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
08:23:15  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
08:23:15  	at java.lang.reflect.Method.invoke(Method.java:597)
08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
08:23:15  	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
08:23:15  Caused by: org.apache.maven.plugin.MojoExecutionException:
Missing site information in the distribution management of the project
Parent Maven POM (com.xxx:xxx-maven-parent:1.0.0-SNAPSHOT)
08:23:15  	at org.apache.maven.plugins.site.AbstractDeployMojo.getSite(AbstractDeployMojo.java:701)
08:23:15  	at org.apache.maven.plugins.site.SiteDeployMojo.getDeployRepositoryID(SiteDeployMojo.java:52)
08:23:15  	at org.apache.maven.plugins.site.AbstractDeployMojo.execute(AbstractDeployMojo.java:155)
08:23:15  	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
08:23:15  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
08:23:15  	... 19 more


On Tue, Mar 8, 2011 at 1:18 PM, Lukas Theussl <lt...@apache.org> wrote:
>
> Hi Jeff,
>
> I deduce you are testing my current development version...?  ;)
>
> I don't see how this particular commit could have broken site generation as
> it only concerns the DeployMojo. However, I see that it could break
> site:stage-deploy, is this what you are seeing?
>
> I don't exclude that I broke something somewhere else, but I need more info
> to track it down, a stack trace or better a test project would help.
>
> Cheers,
> -Lukas
>
>
> Jeff Jensen wrote:
>>
>> Hi Lukas!
>>
>> I have a question on this commit, as it causes our site gen to now fail.
>>
>> With the following change:
>>
>>> +        if ( site == null )
>>> +        {
>>> +            throw new MojoExecutionException(
>>> +                "Missing site information in the distribution management
>>> of the project " + name );
>>> +        }
>>
>> the following use case configuration encounters the above exception:
>>  - a project parent pom has a<distributionManagement><site>  element
>> (modules of course inherit it)
>>  - a corporate parent pom does not have a<distributionManagement><site>
>>  element
>>
>> We never run site gen for the corporate parent pom, so any
>> <distributionManagement><site>  element added will make it work but is
>> unneeded/fake.
>>
>> So wondering if this configuration use case was considered and the
>> correct answer is to add a "fake"<site>  element to the corporate
>> parent or possibly this check for site definition needs tweaking (can
>> it consider the effective one?)?
>>
>>
>> On Fri, Mar 4, 2011 at 6:58 AM,<lt...@apache.org>  wrote:
>>>
>>> Author: ltheussl
>>> Date: Fri Mar  4 12:58:01 2011
>>> New Revision: 1077924
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
>>> Log:
>>> refactor: re-use getSite() so we properly catch null values also in
>>> stage-deploy
>>>
>>> Modified:
>>>
>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>>
>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>>
>>>  maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>>
>>> Modified:
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>> URL:
>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>> (original)
>>> +++
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>> Fri Mar  4 12:58:01 2011
>>> @@ -26,6 +26,8 @@ import java.util.Locale;
>>>
>>>  import org.apache.maven.artifact.manager.WagonConfigurationException;
>>>  import org.apache.maven.artifact.manager.WagonManager;
>>> +import org.apache.maven.model.DistributionManagement;
>>> +import org.apache.maven.model.Site;
>>>  import org.apache.maven.plugin.MojoExecutionException;
>>>  import org.apache.maven.plugin.logging.Log;
>>>  import org.apache.maven.project.MavenProject;
>>> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>>>
>>>         return parent;
>>>     }
>>> +
>>> +    /**
>>> +     * Extract the distributionManagment site from the given
>>> MavenProject.
>>> +     *
>>> +     * @param project the MavenProject. Not null.
>>> +     *
>>> +     * @return the project site. Not null.
>>> +     *      Also site.getUrl() and site.getId() are guaranteed to be not
>>> null.
>>> +     *
>>> +     * @throws MojoExecutionException if any of the site info is
>>> missing.
>>> +     */
>>> +    protected static Site getSite( final MavenProject project )
>>> +        throws MojoExecutionException
>>> +    {
>>> +        final String name = project.getName() + " ("
>>> +            + project.getGroupId() + ":" + project.getArtifactId() + ":"
>>> + project.getVersion() + ")";
>>> +
>>> +        final DistributionManagement distributionManagement =
>>> project.getDistributionManagement();
>>> +
>>> +        if ( distributionManagement == null )
>>> +        {
>>> +            throw new MojoExecutionException( "Missing distribution
>>> management in project " + name );
>>> +        }
>>> +
>>> +        final Site site = distributionManagement.getSite();
>>> +
>>> +        if ( site == null )
>>> +        {
>>> +            throw new MojoExecutionException(
>>> +                "Missing site information in the distribution management
>>> of the project " + name );
>>> +        }
>>> +
>>> +        if ( site.getUrl() == null || site.getId() == null )
>>> +        {
>>> +            throw new MojoExecutionException( "Missing site data:
>>> specify url and id for project " + name );
>>> +        }
>>> +
>>> +        return site;
>>> +    }
>>>  }
>>>
>>> Modified:
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>> URL:
>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>> (original)
>>> +++
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>> Fri Mar  4 12:58:01 2011
>>> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>>>  * under the License.
>>>  */
>>>
>>> -import org.apache.maven.model.DistributionManagement;
>>>  import org.apache.maven.model.Site;
>>>  import org.apache.maven.plugin.MojoExecutionException;
>>> -import org.apache.maven.project.MavenProject;
>>>
>>>  /**
>>>  * Deploys the generated site using<code>scp</code>  or<code>file</code>
>>> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>>>
>>>         return site.getUrl();
>>>     }
>>> -
>>> -    private static Site getSite( final MavenProject project )
>>> -        throws MojoExecutionException
>>> -    {
>>> -        final DistributionManagement distributionManagement =
>>> project.getDistributionManagement();
>>> -
>>> -        if ( distributionManagement == null )
>>> -        {
>>> -            throw new MojoExecutionException( "Missing distribution
>>> management information in the project." );
>>> -        }
>>> -
>>> -        final Site site = distributionManagement.getSite();
>>> -
>>> -        if ( site == null )
>>> -        {
>>> -            throw new MojoExecutionException(
>>> -                "Missing site information in the distribution management
>>> element in the project." );
>>> -        }
>>> -
>>> -        if ( site.getUrl() == null || site.getId() == null )
>>> -        {
>>> -            throw new MojoExecutionException( "Missing site data for
>>> deploy: specify url and id!" );
>>> -        }
>>> -
>>> -        return site;
>>> -    }
>>>  }
>>>
>>> Modified:
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>> URL:
>>> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>> (original)
>>> +++
>>> maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>> Fri Mar  4 12:58:01 2011
>>> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>>>      * @return the site URL for staging
>>>      */
>>>     private String getStagingSiteURL( String usersStagingSiteURL )
>>> +        throws MojoExecutionException
>>>     {
>>>         String topLevelURL = null;
>>>
>>> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>>>         {
>>>             // The user didn't specify a URL, use the top level target
>>> dir
>>>             topLevelURL =
>>> -                getTopLevelParent( project
>>> ).getDistributionManagement().getSite().getUrl() + "/" +
>>> DEFAULT_STAGING_DIRECTORY;
>>> +                getSite( getTopLevelParent( project ) ).getUrl() + "/" +
>>> DEFAULT_STAGING_DIRECTORY;
>>>             getLog().debug( "stagingSiteURL NOT specified, using the top
>>> level project: " + topLevelURL );
>>>         }
>>>
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Lukas Theussl <lt...@apache.org>.
Hi Jeff,

I deduce you are testing my current development version...?  ;)

I don't see how this particular commit could have broken site generation 
as it only concerns the DeployMojo. However, I see that it could break 
site:stage-deploy, is this what you are seeing?

I don't exclude that I broke something somewhere else, but I need more 
info to track it down, a stack trace or better a test project would help.

Cheers,
-Lukas


Jeff Jensen wrote:
> Hi Lukas!
>
> I have a question on this commit, as it causes our site gen to now fail.
>
> With the following change:
>
>> +        if ( site == null )
>> +        {
>> +            throw new MojoExecutionException(
>> +                "Missing site information in the distribution management of the project " + name );
>> +        }
>
> the following use case configuration encounters the above exception:
>   - a project parent pom has a<distributionManagement><site>  element
> (modules of course inherit it)
>   - a corporate parent pom does not have a<distributionManagement><site>  element
>
> We never run site gen for the corporate parent pom, so any
> <distributionManagement><site>  element added will make it work but is
> unneeded/fake.
>
> So wondering if this configuration use case was considered and the
> correct answer is to add a "fake"<site>  element to the corporate
> parent or possibly this check for site definition needs tweaking (can
> it consider the effective one?)?
>
>
> On Fri, Mar 4, 2011 at 6:58 AM,<lt...@apache.org>  wrote:
>> Author: ltheussl
>> Date: Fri Mar  4 12:58:01 2011
>> New Revision: 1077924
>>
>> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
>> Log:
>> refactor: re-use getSite() so we properly catch null values also in stage-deploy
>>
>> Modified:
>>     maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>>     maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>>     maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>>
>> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>> ==============================================================================
>> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original)
>> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Fri Mar  4 12:58:01 2011
>> @@ -26,6 +26,8 @@ import java.util.Locale;
>>
>>   import org.apache.maven.artifact.manager.WagonConfigurationException;
>>   import org.apache.maven.artifact.manager.WagonManager;
>> +import org.apache.maven.model.DistributionManagement;
>> +import org.apache.maven.model.Site;
>>   import org.apache.maven.plugin.MojoExecutionException;
>>   import org.apache.maven.plugin.logging.Log;
>>   import org.apache.maven.project.MavenProject;
>> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>>
>>          return parent;
>>      }
>> +
>> +    /**
>> +     * Extract the distributionManagment site from the given MavenProject.
>> +     *
>> +     * @param project the MavenProject. Not null.
>> +     *
>> +     * @return the project site. Not null.
>> +     *      Also site.getUrl() and site.getId() are guaranteed to be not null.
>> +     *
>> +     * @throws MojoExecutionException if any of the site info is missing.
>> +     */
>> +    protected static Site getSite( final MavenProject project )
>> +        throws MojoExecutionException
>> +    {
>> +        final String name = project.getName() + " ("
>> +            + project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion() + ")";
>> +
>> +        final DistributionManagement distributionManagement = project.getDistributionManagement();
>> +
>> +        if ( distributionManagement == null )
>> +        {
>> +            throw new MojoExecutionException( "Missing distribution management in project " + name );
>> +        }
>> +
>> +        final Site site = distributionManagement.getSite();
>> +
>> +        if ( site == null )
>> +        {
>> +            throw new MojoExecutionException(
>> +                "Missing site information in the distribution management of the project " + name );
>> +        }
>> +
>> +        if ( site.getUrl() == null || site.getId() == null )
>> +        {
>> +            throw new MojoExecutionException( "Missing site data: specify url and id for project " + name );
>> +        }
>> +
>> +        return site;
>> +    }
>>   }
>>
>> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>> ==============================================================================
>> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java (original)
>> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java Fri Mar  4 12:58:01 2011
>> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>>   * under the License.
>>   */
>>
>> -import org.apache.maven.model.DistributionManagement;
>>   import org.apache.maven.model.Site;
>>   import org.apache.maven.plugin.MojoExecutionException;
>> -import org.apache.maven.project.MavenProject;
>>
>>   /**
>>   * Deploys the generated site using<code>scp</code>  or<code>file</code>
>> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>>
>>          return site.getUrl();
>>      }
>> -
>> -    private static Site getSite( final MavenProject project )
>> -        throws MojoExecutionException
>> -    {
>> -        final DistributionManagement distributionManagement = project.getDistributionManagement();
>> -
>> -        if ( distributionManagement == null )
>> -        {
>> -            throw new MojoExecutionException( "Missing distribution management information in the project." );
>> -        }
>> -
>> -        final Site site = distributionManagement.getSite();
>> -
>> -        if ( site == null )
>> -        {
>> -            throw new MojoExecutionException(
>> -                "Missing site information in the distribution management element in the project." );
>> -        }
>> -
>> -        if ( site.getUrl() == null || site.getId() == null )
>> -        {
>> -            throw new MojoExecutionException( "Missing site data for deploy: specify url and id!" );
>> -        }
>> -
>> -        return site;
>> -    }
>>   }
>>
>> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
>> ==============================================================================
>> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java (original)
>> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java Fri Mar  4 12:58:01 2011
>> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>>       * @return the site URL for staging
>>       */
>>      private String getStagingSiteURL( String usersStagingSiteURL )
>> +        throws MojoExecutionException
>>      {
>>          String topLevelURL = null;
>>
>> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>>          {
>>              // The user didn't specify a URL, use the top level target dir
>>              topLevelURL =
>> -                getTopLevelParent( project ).getDistributionManagement().getSite().getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
>> +                getSite( getTopLevelParent( project ) ).getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
>>              getLog().debug( "stagingSiteURL NOT specified, using the top level project: " + topLevelURL );
>>          }
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r1077924 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteDeployMojo.java SiteStageDeployMojo.java

Posted by Jeff Jensen <je...@upstairstechnology.com>.
Hi Lukas!

I have a question on this commit, as it causes our site gen to now fail.

With the following change:

> +        if ( site == null )
> +        {
> +            throw new MojoExecutionException(
> +                "Missing site information in the distribution management of the project " + name );
> +        }

the following use case configuration encounters the above exception:
 - a project parent pom has a <distributionManagement><site> element
(modules of course inherit it)
 - a corporate parent pom does not have a <distributionManagement><site> element

We never run site gen for the corporate parent pom, so any
<distributionManagement><site> element added will make it work but is
unneeded/fake.

So wondering if this configuration use case was considered and the
correct answer is to add a "fake" <site> element to the corporate
parent or possibly this check for site definition needs tweaking (can
it consider the effective one?)?


On Fri, Mar 4, 2011 at 6:58 AM,  <lt...@apache.org> wrote:
> Author: ltheussl
> Date: Fri Mar  4 12:58:01 2011
> New Revision: 1077924
>
> URL: http://svn.apache.org/viewvc?rev=1077924&view=rev
> Log:
> refactor: re-use getSite() so we properly catch null values also in stage-deploy
>
> Modified:
>    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
>    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
>    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
>
> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original)
> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Fri Mar  4 12:58:01 2011
> @@ -26,6 +26,8 @@ import java.util.Locale;
>
>  import org.apache.maven.artifact.manager.WagonConfigurationException;
>  import org.apache.maven.artifact.manager.WagonManager;
> +import org.apache.maven.model.DistributionManagement;
> +import org.apache.maven.model.Site;
>  import org.apache.maven.plugin.MojoExecutionException;
>  import org.apache.maven.plugin.logging.Log;
>  import org.apache.maven.project.MavenProject;
> @@ -552,4 +554,43 @@ public abstract class AbstractDeployMojo
>
>         return parent;
>     }
> +
> +    /**
> +     * Extract the distributionManagment site from the given MavenProject.
> +     *
> +     * @param project the MavenProject. Not null.
> +     *
> +     * @return the project site. Not null.
> +     *      Also site.getUrl() and site.getId() are guaranteed to be not null.
> +     *
> +     * @throws MojoExecutionException if any of the site info is missing.
> +     */
> +    protected static Site getSite( final MavenProject project )
> +        throws MojoExecutionException
> +    {
> +        final String name = project.getName() + " ("
> +            + project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion() + ")";
> +
> +        final DistributionManagement distributionManagement = project.getDistributionManagement();
> +
> +        if ( distributionManagement == null )
> +        {
> +            throw new MojoExecutionException( "Missing distribution management in project " + name );
> +        }
> +
> +        final Site site = distributionManagement.getSite();
> +
> +        if ( site == null )
> +        {
> +            throw new MojoExecutionException(
> +                "Missing site information in the distribution management of the project " + name );
> +        }
> +
> +        if ( site.getUrl() == null || site.getId() == null )
> +        {
> +            throw new MojoExecutionException( "Missing site data: specify url and id for project " + name );
> +        }
> +
> +        return site;
> +    }
>  }
>
> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java (original)
> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java Fri Mar  4 12:58:01 2011
> @@ -19,10 +19,8 @@ package org.apache.maven.plugins.site;
>  * under the License.
>  */
>
> -import org.apache.maven.model.DistributionManagement;
>  import org.apache.maven.model.Site;
>  import org.apache.maven.plugin.MojoExecutionException;
> -import org.apache.maven.project.MavenProject;
>
>  /**
>  * Deploys the generated site using <code>scp</code> or <code>file</code>
> @@ -68,30 +66,4 @@ public class SiteDeployMojo
>
>         return site.getUrl();
>     }
> -
> -    private static Site getSite( final MavenProject project )
> -        throws MojoExecutionException
> -    {
> -        final DistributionManagement distributionManagement = project.getDistributionManagement();
> -
> -        if ( distributionManagement == null )
> -        {
> -            throw new MojoExecutionException( "Missing distribution management information in the project." );
> -        }
> -
> -        final Site site = distributionManagement.getSite();
> -
> -        if ( site == null )
> -        {
> -            throw new MojoExecutionException(
> -                "Missing site information in the distribution management element in the project." );
> -        }
> -
> -        if ( site.getUrl() == null || site.getId() == null )
> -        {
> -            throw new MojoExecutionException( "Missing site data for deploy: specify url and id!" );
> -        }
> -
> -        return site;
> -    }
>  }
>
> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1077924&r1=1077923&r2=1077924&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java (original)
> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java Fri Mar  4 12:58:01 2011
> @@ -93,6 +93,7 @@ public class SiteStageDeployMojo
>      * @return the site URL for staging
>      */
>     private String getStagingSiteURL( String usersStagingSiteURL )
> +        throws MojoExecutionException
>     {
>         String topLevelURL = null;
>
> @@ -106,7 +107,7 @@ public class SiteStageDeployMojo
>         {
>             // The user didn't specify a URL, use the top level target dir
>             topLevelURL =
> -                getTopLevelParent( project ).getDistributionManagement().getSite().getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
> +                getSite( getTopLevelParent( project ) ).getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
>             getLog().debug( "stagingSiteURL NOT specified, using the top level project: " + topLevelURL );
>         }
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org