【问题标题】:Gradle is failing on malformed pom.xml in Central MavenGradle 在 Central Maven 中格式错误的 pom.xml 上失​​败
【发布时间】:2018-06-05 17:40:03
【问题描述】:

我有这个 maven 脚本 sn-p:

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

现在在运行构建时,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'

当我查看存储库中 pom.xml 文件的内容时,我注意到,虽然 pom.xml 位于正确的位置,但它表示的版本与预期不同。在这种情况下,jdom 版本 b10 的 pom 文件指示 10 而不是 b10。另一个问题显示 Commons Discovery » 20030211.213356 的 pom 文件指示 2d 或类似的东西,而不是版本 20030211.213356。我尝试排除损坏的依赖项,但发现这会引入同类的新问题。你能帮我解决这个问题吗?

【问题讨论】:

  • 请注意,我也尝试过将 centralMaven() 作为存储库。那里的 pom(s) 肯定格式不正确。 Generama 1.2.3 甚至在其 pom 中包含格式错误的 XML 数据,这使得它无法使用,因为等级会抱怨 1-bite 的字节 1 不是 UTF-8

标签: java maven gradle groovy


【解决方案1】:

您可以尝试排除故障的并包括工作的:

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

【讨论】:

  • 谢谢@tkruse,它立即解决了问题。我应该首先考虑一下。但是,是的,每个人都必须至少学习一次!
猜你喜欢
  • 2017-08-05
  • 2014-10-16
  • 1970-01-01
  • 2017-06-26
  • 2012-10-05
  • 1970-01-01
  • 1970-01-01
  • 2016-10-03
相关资源
最近更新 更多