Kohsuke Kawaguchi created MSITE-632:
---------------------------------------

             Summary: <site> from child module ignored
                 Key: MSITE-632
                 URL: https://jira.codehaus.org/browse/MSITE-632
             Project: Maven 2.x and 3.x Site Plugin
          Issue Type: Bug
          Components: site:deploy
    Affects Versions: 3.0
            Reporter: Kohsuke Kawaguchi


In trying to deploy 
https://github.com/kohsuke/windows-package-checker/tree/4658075119d6ce9e4d6b9975342bbbef477d5f50
 , I noticed that the <site> I specified in this POM is ignored and the one 
specified in the parent is used instead. The same site deploys as expected with 
Maven2 with the site plugin 2.0-beta-7.

Looking at the source code, I see that 
{{SiteDeployMojo.getDeployRepositoryURL()}} uses {{getRootSite}} to determine 
the site to deploy, which explains why my <site> definition is getting ignored.

I believe the fix is to use the nearest site definition, not the one that's 
closest to the root of the inheritance chain. That is, the {{getRootSite()}} 
should be changed from:

{code}
    protected Site getRootSite( MavenProject project )
        throws MojoExecutionException
    {
        Site site = getSite( project );

        MavenProject parent = project;

        while ( parent.getParent() != null )
        {
            // MSITE-585, MNG-1943
            parent = siteTool.getParentProject( parent, reactorProjects, 
localRepository );

            try
            {
                site = getSite( parent );
            }
            catch ( MojoExecutionException e )
            {
                break;
            }
        }

        return site;
    }
{code}

to

{code}
    protected Site getRootSite( MavenProject project )
        throws MojoExecutionException
    {
        Site site = getSite( project );

        MavenProject parent = project;

        while ( site ==null && parent.getParent() != null )
        {
            // MSITE-585, MNG-1943
            parent = siteTool.getParentProject( parent, reactorProjects, 
localRepository );

            try
            {
                site = getSite( parent );
            }
            catch ( MojoExecutionException e )
            {
                break;
            }
        }

        return site;
    }
{code}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to