Skip to content
Advertisement

Gradle is failing on malformed pom.xml in Central Maven

I have this gradle script snippet:

repositories {
    maven {
        url 'http://central.maven.org/maven2/'
    }
    maven {
        url 'http://repository.jspresso.org/maven2/'
    }
}


dependencies {
    compile 'org.codehaus.groovy:groovy-all:2.3.11'
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile gradleApi()
    compile localGroovy()

    // https://mvnrepository.com/artifact/xdoclet/xdoclet
    compile(group: 'xdoclet', name: 'xdoclet', version: '2.0.6') {
        exclude(group: 'generama', module: 'generama')
    }

    // https://mvnrepository.com/artifact/org.codehaus.generama/generama
    compile group: 'org.codehaus.generama', name: 'generama', version: '1.2.4'
}

Now when running a build, Gradle consistently fails on downloading transitive dependencies and gives me this message:

> Could not resolve jdom:jdom:b10.
  Required by:
      project : > org.codehaus.generama:generama:1.2.4 > commons-jelly:commons-jelly-tags-xml:1.1 > jaxen:jaxen:1.1-beta-4
   > Could not resolve jdom:jdom:b10.
      > inconsistent module metadata found. Descriptor: jdom:jdom-:10 Errors: bad module name: expected='jdom' found='jdom-'
        bad version: expected='b10' found='10'

When I had a look at the content of the pom.xml file from the repository, I noticed that, although the pom.xml is in the right place, it indicates a version different than what is expected. In this case, the pom file for jdom version b10 indicates 10 instead of b10. Another issue reveals that the pom file for Commons Discovery ยป 20030211.213356 indicates 2d or something similar instead of version 20030211.213356. I’ve tried excluding the broken dependencies but only to find out that this introduces new issues of the same kind. Can you help me resolve this, please?

Advertisement

Answer

You can try excluding the faulty ones and including working ones:

compile('org.codehaus.generama:generama:1.2.4') {
    exclude(group: 'commons-discovery', module: 'commons-discovery')
    exclude(group: 'jdom', module: 'jdom')  
}
compile('jdom:jdom:1.0')
compile('commons-discovery:commons-discovery:0.2')
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement