我的gradle项目使用该application插件来构建一个jar文件.作为运行时传递依赖的一部分,我最终会进入org.slf4j:slf4j-log4j12.(它被引用为至少5或6个其他传递依赖的子传递依赖 - 这个项目使用spring和hadoop,所以除了厨房水槽之外的所有东西都被拉进来......没等了......那也是:) ).
我想slf4j-log4j12从我的内置jar中全局排除jar.所以我试过这个:
configurations {
runtime.exclude group: "org.slf4j", name: "slf4j-log4j12"
}
Run Code Online (Sandbox Code Playgroud)
但是,这似乎排除了所有 org.slf4j工件,包括slf4j-api.在调试模式下运行时,我看到以下行:
org.slf4j#slf4j-api is excluded from com.pivotal.gfxd:gfxd-demo-mapreduce:1.0(runtime).
org.slf4j#slf4j-simple is excluded from com.pivotal.gfxd:gfxd-demo-mapreduce:1.0(runtime).
org.slf4j#slf4j-log4j12 is excluded from org.apache.hadoop:hadoop-common:2.2.0(runtime).
Run Code Online (Sandbox Code Playgroud)
我不想查找每个slf4j-log4j12传递依赖的源,然后compile foo { exclude slf4j... }在我的dependencies块中有单独的语句.
更新:
我也试过这个:
configurations {
runtime.exclude name: "slf4j-log4j12"
}
Run Code Online (Sandbox Code Playgroud)
最终排除了构建中的所有内容!好像我指定的那样group: "*".
更新2:
我正在使用Gradle版本1.10.
我的 gradle 项目结构如下所示:
geode-core
geode-lucene
extensions/geode-modules
extensions/geode-modules-session
Run Code Online (Sandbox Code Playgroud)
例如,对于extensions子项目,gradle 任务将因此被引用extensions/geode-modules:build。
当我尝试在 Gradle 中使用 SonarQube 时,出现以下错误(这是 1.2 SonarQube Gradle 插件):
Validation of project reactor failed:
o "io.pivotal.gemfire:extensions/geode-modules" is not a valid project or module key. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.
o "io.pivotal.gemfire:extensions/geode-modules-session" is not a valid project or module key. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.
Run Code Online (Sandbox Code Playgroud)
所以/模块名称中的 导致了问题。为了解决它,我尝试按照此线程上的解决方案进行操作:http …