问题描述
我需要一个在pom中版本号不一致的依赖项.
I need a dependency which has an inconsistent version number in it's pom.
Apache XmlSchema- Pom 的版本为SNAPSHOT
,显然不正确,因为它应该为1.1
.
Apache XmlSchema-Pom has as version SNAPSHOT
which is obviously not correct as it should be 1.1
.
根据此逐步讨论,如果将maven存储库指定为常春藤仓库,将@jar
或transitive = false
添加到依赖项,所有这些对我都不起作用
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
以下是我的build.gradle
我的尝试:
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'
}
这是gradle输出的错误消息:
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'
推荐答案
我解决此问题的方式有所不同,我不想接触人工制品pom,因为我无法使用人工制品.这是您在gradle.build中需要的代码
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
}
}
}
这篇关于如何忽略错误的Pom“不一致的模块描述符"(版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!