gpt4 book ai didi

java - Gradle排除依赖极度困惑

转载 作者:行者123 更新时间:2023-11-30 08:35:10 25 4
gpt4 key购买 nike

我非常困惑,我不是 gradle 专家,对 Groovy 语法不是很熟悉。问题是,我在我的日志记录库中有一个我想排除的传递依赖,但是当我尝试使用 gradle bootRun 启动我的应用程序时,看起来我不能因为有某种语法错误而且我无法弄清楚它是什么是。这是我得到的错误:

>gradle bootRun

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\workspace\tictactoe\build.gradle' line: 55

* What went wrong:
A problem occurred evaluating root project 'tictactoe'.
> No signature of method: java.util.LinkedHashMap.call() is applicable for argument types: (build_bkiihj275q6h9zzyz2rjvcelk$_run_closure3$_closure7) values: [build_bkiihj275q6h9zzyz2
rjvcelk$_run_closure3$_closure7@7d42404e]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), take(int), max(groovy.lang.Closure)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.678 secs

这是我的 gradle.build 的一部分,我在其中添加了所有依赖项:

compile (
[group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.6.2'],
[group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'],
[group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'],
[group: 'org.springframework.boot', name: 'spring-boot-starter-logging'],
[group: 'org.springframework', name: 'spring-context-support'],
[group: 'org.apache.commons', name: 'commons-lang3', version: commonsLangVersion],
[group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion],
[group: 'org.slf4j', name: 'slf4j-log4j12', version:'1.7.10']
{
exclude group: 'ch.qos.logback', module: 'logback-classic'
},
[group: 'log4j', name: 'log4j', version:'1.2.17'],
[group: 'com.mashape.unirest', name: 'unirest-java', version: unirestVersion],
[group: 'com.cedarsoftware', name: 'json-io', version: jsonioVersion]
)

最佳答案

您可能希望从您的项目中全局排除 logback。最简单的方法是将以下内容添加到项目的 build.gradle 中:

configurations.all {
exclude group: "ch.qos.logback", module: "logback-classic"
}

如果您想排除该组中的所有内容而不仅仅是特定的工件(logback-classic),您可以省略 module。像这样:

configurations.all {
exclude group: "ch.qos.logback"
}

关于java - Gradle排除依赖极度困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38404750/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com