问题
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.
- Try use an other version of that dependency, where the pom is valid
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)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