hub*_*blo 2 java copy gradle build.gradle
我有一个复制任务集如下:
task copyToLib( type: Copy ) {
into "$buildDir/myapp/lib"
from configurations.runtime
// We only want jars files to go in lib folder
exclude "*.exe"
exclude "*.bat"
exclude "*.cmd"
exclude "*.dll"
// We exclude some lib
exclude group: "org.slf4j", name: "slf4j-api", version: "1.6.2"
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Could not find method exclude() for arguments [{group=org.slf4j, name=slf4j-api, version=1.6.2}] on task ':copyToLib' of type org.gradle.api.tasks.Copy
Run Code Online (Sandbox Code Playgroud)
我觉得这只是一个语法问题,有什么提示吗?
按组排除: exclude group: org.slf4j
按模块排除: exclude module: slf4j-api
按文件名排除: exclude { it.file.name.contains('slf4j-api') }
排除文件: exclude "slf4j-api.jar"
您可以按组和模块排除,但它需要像这样进入配置排除。然后它会在复制之前限制配置。
task copyToLib( type: Copy ) {
into "$buildDir/myapp/lib"
from configurations.runtime {
exclude group: 'org.slf4j'
}
// We only want jars files to go in lib folder
exclude "*.exe"
exclude "*.bat"
exclude "*.cmd"
exclude "*.dll"
}
Run Code Online (Sandbox Code Playgroud)
并记住确保目录存在 $buildDir/myapp/lib
也许不是排除所有其他文件,而是只包含 jars?
| 归档时间: |
|
| 查看次数: |
4193 次 |
| 最近记录: |