Whilst upgrading our build to use Maven 3 and the reporting to use the maven-site-plugin 3.0-beta-3 I used the following steps to upgrade the reporting.
When I ran the build it failed
With the message
Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0-beta-3:site (default-site) on project webapp: failed to get Reports: Could not find goal 'index' in plugin org.jvnet.mcvp:maven-css-validator-plugin:1.0.0-SNAPSHOT among available goals report, validate -> [Help 1]
The plugin I was using (a version of the maven css validation plugin that I have modified to generate reports) was defined in the maven 3 build as follows
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<configuration>
<reportPlugins>
....
<plugin>
<groupId>org.jvnet.mcvp</groupId>
<artifactId>maven-css-validator-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
</plugin>
.....
</reportPlugins>
</configuration>
....
</plugin>
When the plugin was configured under maven 2 (using the legacy reporting i.e. being in a <reporting> tag) it ran fine.
The fix
The last part of the exception states: among available goals report, validate
The “report” goal creates the report therefore modifiynig the pom so it specifies the “report” goal in a report set seems to work.
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<configuration>
<reportPlugins>
....
<plugin>
<groupId>org.jvnet.mcvp</groupId>
<artifactId>maven-css-validator-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
.....
</reportPlugins>
</configuration>
....
</plugin>
I assume that the Could not find goal ‘index’ portion of the error means that if I set the name of the goal to index perhaps the reportsets are not necessary?
Update: Changing the goal to “index” does indeed remove the need for the reportsets, however for legacy plugins you may not be able to modify the source code!
Another thing to note is that this plugin uses the Maven Anno Mojo
e.g.
@MojoGoal("index")
@MojoPhase("site")
public class CssReportingMojo extends AbstractMavenReport {
But I dont think this has anything to do with error.
I hope this is useful to anyone upgrading as I couldn’t find any info on this exception out there
Using Maven to check facelets are valid
Beware what you put in the endorsed dir!
Hacker