繁体   English   中英

为什么 Gradle 5 (5.6.3) 在组件解析过程中做出了意外的决定?

[英]Why Gradle 5 (5.6.3) made an unexpected decision during component resolution?

我有一个非常大的多项目 java 构建。 在 Gradle 5(4.10.3->5.6.3) 更新之后,最可怕的事情之一就是依赖解析过程中的意外失败:

...
dependencies {
// I know about the deprecation of 'compile', with 'implementation' I have the same problems
    compile project(":Monitor")
    compile project(":WFPlugins-Server")
    compile project(":web-spring")
    compile project(":Security")
    compile project(":Client")
}
...

对我来说很清楚,它应该是一个项目依赖。 但我收到:

FAILURE: Build failed with an exception.



* What went wrong:

Execution failed for task ':SpringWFS:compileJava'.

> Could not resolve all files for configuration ':SpringWFS:compileClasspath'.
   > Could not find com.company:WFPlugins-Server:1.12.

     Required by:
         project :SpringWFS

因此,gradle 试图将其解决为ExternalModuleDependency [在 gradle 方面] 而不是DefaultProjectDependency并且构建按预期失败

有人解决这个问题吗?

评论:

  1. 请不要提出复合构建(目前不可能,但我正在努力)
  2. 更改构建系统(我们有一个非常大的项目):)

Gradle 将项目依赖替换为模块依赖的唯一原因是:

  • 如果定义了替换规则。 检查您是否有任何定义。
  • 如果您在构建中的其他地方引用WFPlugins-Server作为二进制依赖项,并且它作为SpringWFS依赖项图的一部分出现,并且它的版本高于项目。

在最后一种情况下,您可以调整解析策略以更喜欢 project 而非 modules

暂无
暂无

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

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