Warning after gradle update 1.9 with PMD plugin


(Mathias Kalb) #1

Hello,

after updating gradle from 1.8 to 1.9 the “pmd” plugin shows a warning.

:pmdMain
POM relocation to an other version number is not fully supported in Gradle : xml-apis#xml-apis;2.0.2 relocated to xml-apis#xml-apis;1.0.b2.
Please update your dependency to directly use the correct version 'xml-apis#xml-apis;1.0.b2'.
Resolution will only pick dependencies of the relocated element.
Artifacts and other metadata will be ignored.
dependencies {
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'
    compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.13'
      // These dependencies are only needed for running tests
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

(Peter Niederwieser) #2

I don’t think the problem is related to PMD. Does one of your dependencies pull in ‘xml-apis’? Perhaps this is just a new warning, though I think I’ve seen it before.


(Benjamin Muschko) #3

We made some internal changes to the POM parsing in 1.9. Before this warning message simply did come to the surface. Artifact relocation defined in a POM only has limited support in Gradle. In this case the XML-APIs POM looks like this:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>2.0.2</version>
    <distributionManagement>
        <relocation>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.0.b2</version>
        </relocation>
    </distributionManagement>
</project>

If you want to avoid this message, you can upgrade to a later version of the PMD dependency. 5.0.5 for example does not depend on a relocated artifact anymore. You can reconfigure your PMD plugin as such:

pmd {
    toolVersion = '5.0.5'
}

In the long run we should probably upgrade the PMD plugin to use PMD 5.x by default.


(Mathias Kalb) #4

Thank you for this helpful information.