Unable to locate Source XRef to link to

Solution 1:

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>2.3</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.

Solution 2:

Mind there is also the ability to disable the xref feature by adding

<configuration>
  <linkXRef>false</linkXRef>
</configuration>

to the maven-pmd-plugin plugin. This resolves the warning without making the build even longer due to running an additional reporting plugin. E.g. if you run your builds in Jenkins, the Jenkins PMD plugin can take care of relating PMD warnings to source code, there is no need to run another Maven plugin for this.