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

坚强是说给别人听的谎言 提交于 2019-12-10 17:23:12

问题


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'

回答1:


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
                }
          }
      }
}



回答2:


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



来源:https://stackoverflow.com/questions/41586289/how-to-ignore-bad-pom-inconsistent-module-descriptor-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!