Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore bad pom 'inconsistent module descriptor' (version)

I need a dependency which has an inconsistent version number in it's pom.

Apache XmlSchema-Pom has as version SNAPSHOT which is obviously not correct as it should be 1.1.

According to this gradle discussion it should be possible if the maven repository specified as an ivy repo, adding @jar or transitive = false to the dependency, all that didn't work for me

Here my build.gradle with my attempts:

group 'de.company'
version '1.0-SNAPSHOT'

apply plugin: 'maven'
apply plugin: 'java'

repositories {
    // specified as ivy repo
    // ivy {
    //     url = mavenCentral().url
    // }
    mavenCentral()
}

dependencies {
    // with @jar and transitive
    // compile (group: 'org.apache.ws.commons', name: 'XmlSchema', version: '1.1', ext: 'jar') {
    //     transitive = false
    // }
    compile group: 'org.apache.ws.commons', name: 'XmlSchema', version: '1.1'
}

Here is the error message which gradle outputs:

Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not resolve org.apache.ws.commons:XmlSchema:1.1.
  Required by:
      de.company:gradle-test:1.0-SNAPSHOT
   > Could not resolve org.apache.ws.commons:XmlSchema:1.1.
      > inconsistent module metadata found. Descriptor: org.apache.ws.commons:XmlSchema:SNAPSHOT Errors: bad version: expected='1.1' found='SNAPSHOT'
like image 266
jmattheis Avatar asked Jan 11 '17 08:01

jmattheis


2 Answers

The way i solved this is different, I don't want to touch artifactory pom as i don't have access to artifactory. here is the code you need in gradle.build

repositories {
    maven {
        url 'http://xxxxx/xx'
        metadataSources {
             artifact() //Look directly for artifact
        }
    }
}
like image 59
Md Ayub Ali Sarker Avatar answered Jan 02 '23 20:01

Md Ayub Ali Sarker


As to the current date, there is no actual way of ignoring the validating of the poms from gradle.

Still there are some ways to workaround that.

  1. Try use an other version of that dependency, where the pom is valid
  2. Check other repositories, maybe they have an valid pom for the depedency you want.

    that would be in my example for XmlSchema the jcenter repository (XmlSchema from jcenter)

  3. Download the sources by yourself and deploy it into your local/company repository and use this version instead

like image 26
jmattheis Avatar answered Jan 02 '23 22:01

jmattheis