排除Grails构建范围依赖项

noa*_*amt 6 grails dependencies build

使用Grails 2.4.3,如何排除在build作用域中定义的依赖项?

Grails与图书馆捆绑在一起spock-core-0.7-groovy-2.0.jar; 添加标准全局依赖项排除时:

...
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits('global') {
        excludes 'spock-core'
    }
...
Run Code Online (Sandbox Code Playgroud)

除范围外,Spock被排除在所有依赖范围之外build.

th3*_*org 0

问题是您不希望它出现在 .war 文件中吗?如果是这样,您可以像这样删除它:

grails.war.resources = { stagingDir ->
  delete(file:"${stagingDir}/WEB-INF/lib/spock-core-0.7-groovy-2.0.jar")
}
Run Code Online (Sandbox Code Playgroud)