简体   繁体   English

Gradle在Central Maven中格式错误的pom.xml失败

[英]Gradle is failing on malformed pom.xml in Central Maven

I have this maven script snippet: 我有这个Maven脚本片段:

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: 现在,当运行构建时,Gradle始终无法下载传递依赖项,并显示以下消息:

> 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. 当我查看存储库中pom.xml文件的内容时,我注意到,尽管pom.xml在正确的位置,但它表示的版本与预期的版本不同。 In this case, the pom file for jdom version b10 indicates 10 instead of b10. 在这种情况下,jdom版本b10的pom文件表示10而不是b10。 Another issue reveals that the pom file for Commons Discovery » 20030211.213356 indicates 2d or something similar instead of version 20030211.213356. 另一个问题表明,Commons Discovery»20030211.213356的pom文件指示2d或类似的名称,而不是版本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? 您能帮我解决这个问题吗?

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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM