I'm trying to get the maven site plugin to do my bidding but have gotten lost...

Given the following simple POM's

pom.xml:

<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>ch.pecunifex</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <url>http://localhost/parent</url>

    <modules>
        <module>child</module>
    </modules>

    <properties>
        <version.site.plugin>3.2</version.site.plugin>
        <version.info.plugin>2.6</version.info.plugin>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${version.site.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>${version.info.plugin}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>summary</report>
                            <report>project-team</report>
                            <report>modules</report>
                            <report>plugins</report>
                            <report>plugin-management</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

</project>

and child/pom.xml:

<project>
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>ch.pecunifex</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <groupId>ch.pecunifex</groupId>
    <artifactId>child</artifactId>
    <url>http://localhost/child</url>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

</project>

and the documentation on:

    http://maven.apache.org/plugins/maven-site-plugin/maven-3.html

I get the following when I call "mvn site":

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for 
ch.pecunifex:child:jar:1.0-SNAPSHOT
[WARNING] 'reporting.plugins.plugin.version' for 
org.apache.maven.plugins:maven-project-info-reports-plugin is missing. @ line 
16, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for 
ch.pecunifex:parent:pom:1.0-SNAPSHOT
[WARNING] 'reporting.plugins.plugin.version' for 
org.apache.maven.plugins:maven-project-info-reports-plugin is missing. @ line 
38, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten 
the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support 
building such malformed projects.
[WARNING]

while the documentation clearly states that:

When used with Maven 3, a report plugin version can be empty (like build 
plugins).

The following order/strategy will be used to find/resolve a version:

   - search the same groupId/artifactId in the build.plugins section
   - search the same groupId/artifactId in the build.pluginManagement.plugins 
section
   - resolve with current repositories (can include automatic SNAPSHOT 
resolution)

Why do I get the warning? And on the wrong line to boot?

And, worse yet, a little later I get:

...
[INFO] ------------------------------------------------------------------------
[INFO] Building parent 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.2:site (default-site) @ parent ---
[INFO] configuring report plugin 
org.apache.maven.plugins:maven-project-info-reports-plugin:2.6
[INFO] Relativizing decoration links with respect to project URL: 
http://localhost/parent
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 
skin.
[INFO] Generating "About" report    --- maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Summary" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Team" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Modules" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Plugins" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Plugin Management" report    --- 
maven-project-info-reports-plugin:2.6
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building child 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.2:site (default-site) @ child ---
[INFO] configuring report plugin 
org.apache.maven.plugins:maven-project-info-reports-plugin:2.6
[INFO] Relativizing decoration links with respect to project URL: 
http://localhost/child
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 
skin.
[INFO] Generating "About" report    --- maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Summary" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Team" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Project Plugins" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] Generating "Plugin Management" report    --- 
maven-project-info-reports-plugin:2.6
[INFO] ------------------------------------------------------------------------
...

whereas the documentation clearly states:

Maven 2 and Maven 3 work differently when dealing with inheritance of reports: 
given a plugin
providing multiple report goals, in Maven 2, reports configured in child pom 
are added to
reports from parent, whereas in Maven 3 reports from child replace reports from 
parent.

For example, given a multi module build where the parent POM has the index 
report configured
and the child POM has the summary report configured for 
maven-project-info-reports-plugin plugin:

    with Maven 2, the child site will have both the index and summary reports,
    with Maven 3, the child site will have only the summary report.

For more info see MSITE-596

... and just to verify that I'm running the latest and greatest:

$ mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
14:51:28+0100)
Maven home: /home/xxxxx/.lib/apache-maven-3.0.5
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.7.0_17/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-39-generic", arch: "amd64", family: "unix"

So what am I supposed to believe?
Is the documentation that obviously was updated for Maven-3 incorrect?
Is the current behaviour (which seems to be what Maven-2 did) correct?
Can I somehow get the documented behaviour (because that is what I want)?

Cheers,
Wolf

P.S.: The POMs given are simplified versions of the POMs I really have, so please ignore that the reduced set of reports does not really make sense. I also have similar problems with other reporting plugins (trying to suppress reports inherited from a parent that do not make sense in a few special cases) but the other way round (i.e. adding the same reports to >90% of the POMs because I can't suppress them in a few places) does not really appeal to me - after all I was hoping to *reduce* the amount of scaffolding required to build these applications...


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to