需要使用gradle构建文件从eclipse中排除依赖项

Bas*_*usa 5 eclipse gradle

我试图从我的gradle构建中排除一个依赖项,主要是"slf4j-simple".它运作良好,但是当我运行"gradle eclipse"时没有反映出来.

我的gradle构建文件中有以下代码:

apply plugin:'war'
apply plugin:'eclipse'
apply plugin:'jetty'
...
dependencies {
    compile 'mysql:mysql-connector-java:5.1.16'
    compile 'net.sourceforge.stripes:stripes:1.5'
    compile 'javax.servlet:jstl:1.2'
    ... (Rest of the dependencies)
}
configurations {
        all*.exclude group:'org.slf4j',module:'slf4j-simple'
}
Run Code Online (Sandbox Code Playgroud)

现在,当我运行"gradle这个建设",则SLF4J-简单排除在创建war文件这是罚款.

当我运行'gradle eclipse'时,slf4j-simple不会从eclipse类路径中排除.

gradle cookbook中提到了该问题的解决方案,但我不明白如何应用它:

http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-ExcludingdependenciesfromEclipseProjects

rod*_*ion 4

尝试将其添加到您的 build.gradle 中:

eclipseClasspath{
  plusConfigurations.each{
    it.allDependencies.each{ it.exclude group: 'org.slf4j', module: 'slf4j-simple' }
  }
}
Run Code Online (Sandbox Code Playgroud)