Search code examples
javamavenmaven-3pmd

Unable to locate Source XRef to link to


I have a big Maven project that uses the PMD plugin for code quality checks.

since I started using the PMD plugin i get the following warning message:

[WARNING] Unable to locate Source XRef to link to - DISABLED

I googled and found that i need to implement the JXR plugin.

So I added the following to the main pom.xml file.

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jxr-plugin</artifactId>
    <version>2.3</version>
  </plugin>

It doesn't really change anything.

Any ideas what I need to change in order to resolve this warning message?

output of mvn -version

Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/share/maven-bin-3.0
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: /usr/lib64/icedtea7/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.5.2-gentoo", arch: "amd64", family: "unix"

thanks!


Solution

  • You should add the maven-jxr-plugin to the reportingPlugin section.

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>3.3.0</version>
            </plugin>
        </plugins>
    </reporting>
    

    Re run it and enjoy.

    BTW, maybe you'll need to run once the jxr:jxr goal to first generate some file that will be used by pmd.