我正在我的一个项目中使用应用程序插件。升级到Gradle 7.x后,我遇到了故障:
Execution failed for task ':xyz:distTar'.
> Entry xyz-1.0/lib/jaxb-core-3.0.1.jar is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.3.3/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.
我发现了一个堆栈溢出的帖子与Gradle 7 task ':distTar' is a duplicate but no duplicate...有关。但是合并的建议...
tasks.withType<Tar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType<Zip>{
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
没有成功。它以失败告终。
A problem occurred evaluating project ':integration-test'.
> Could not get unknown property 'withType' for task set of type org.gradle.api.internal.tasks.DefaultTaskContainer.
我的build. gradle看起来基本上是这样的...
apply plugin: 'java'
apply plugin: 'application'
version = '1.0'
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
implementation(
...
)
}
application {
mainClassName = 'a.b.c.XYZ'
}
你知道吗?
2条答案
按热度按时间dw1jzc5e1#
那不是应该加上正规的括号吗?
或:
qxsslcnc2#
请注意,如果您在应用程序插件中使用
installDist
任务(而不是distTar),则需要设置: