Gradle "angular-1.8.3" 是重复但没有设置重复处理策略

问题描述 投票:0回答:1

我有一个 Spring Boot 2.2.x 项目,执行时出现以下错误

gradlew build

* What went wrong:
Execution failed for task ':myproject:bootWar'.
> Entry WEB-INF/lib/angular-1.8.3.jar is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.6/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

不幸的是,这个错误发生在一次大的升级过程之后(从 Spring 1.5 开始),所以我无法真正追踪我所做的任何更改。

我怎样才能找出重复的来源?

根据我在 Stackoverflow 上找到的答案,每个人都不断建议通过排除“第二个”重复项来处理重复项。但是我没有找到适用于所有任务的解决方案 - 因为如果我为任务设置处理策略

bootWar
我会为其他以某种方式生成某些东西的任务(Jar,Tar,Zip,你的名字)得到相同的错误.
另外我认为问题的根本原因是重复的角度 jar 文件。我想解决这个问题。

我已经找到的答案:
https://github.com/TheBoegl/gradle-launch4j/issues/117
如何解决构建问题:条目 com/netflix/server/context/BiDirectional.class 是重复的,但没有设置重复处理策略
Gradle“Entry .classpath 是重复的,但没有设置重复处理策略”

java spring spring-boot gradle dependencies
1个回答
0
投票

最后通过将导入语句更改为:

来修复它
implementation ('org.webjars.npm:github-com-daniel-nagy-fixed-table-header:0.2.1') {
    exclude group: 'org.webjars.npm'
}

问题是依赖性

org.webjars.npm:angular:1.8.3
带有两个不同的依赖性。这是根本问题。我认为应用重复处理策略只是以错误的方式处理它。

另见这篇文章:https://github.com/spring-projects/spring-boot/issues/33659

© www.soinside.com 2019 - 2024. All rights reserved.