Search code examples
javajakarta-eemavenmaven-2maven-3

Upgrading to maven 3 from maven 2


I have upgraded from Maven 2 to Maven 3 and it seems to be working fine to clean install.

However, in the Maven 3.x Compatibility Notes, it is mentioned that the <reporting> tag is no longer supported and should be moved up to the <build> tag.


<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.1</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>dependencies</report>
              <report>dependency-convergence</report>
              <report>dependency-management</report>
              <report>index</report>
              <report>plugin-management</report>
              <report>project-team</report>
              <report>license</report>
              <report>summary</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>  

I have commented this out and moved the plugin tag and its content, to the <build><plugins> tag.

When I run mvn validate now, I get the following error:

[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.company.projectName:ProjectName:1.2 (C:\Svn\projectName\branches\projectName-1.2\System\4_ImplementationSet\WAS\src\pom.xml) has 1 error
[ERROR]     Malformed POM C:\Svn\projectName\branches\projectName-1.2\System\4_ImplementationSet\WAS\src\pom.xml: Unrecognised tag: 'reportSets' (position: START_TAG seen ...</version>\r\n        <reportSets>... @123:21)  @ C:\Svn\projectName\branches\projectName-1.2\System\4_ImplementationSet\WAS\src\pom.xml, line 123, column 21 -> [Help 2]

Am I missing something? I could just leave things as they are, but I gave it a try to move it, but it did not work.


Solution

  • Try:

        <plugins>
           ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <reportPlugins> 
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.4</version>
                            <configuration>
                                <reportSets>
                                    <reportSet>
                                        <reports>
                                            <report>dependencies</report>
                                            <report>dependency-convergence</report>
                                            <report>dependency-management</report>
                                            <report>index</report>
                                            <report>plugin-management</report>
                                            <report>project-team</report>
                                            <report>license</report>
                                            <report>summary</report>
                                        </reports>
                                    </reportSet>
                                </reportSets>
                            </configuration>
                        </plugin>
                        ...
                    </reportPlugins>
                </configuration>
            </plugin>
            ...
        </plugins>
    

    (untested; I'm not sure about the reportSets-part)