![](/img/trans.png)
[英]Exclude all compiled classes from jar built by gradle java project
[英]Exclude Compiled Source From Custom Jar with Gradle
我正在嘗試從特定的類包構建一個 JAR,所以我想從這個 JAR 中排除所有其他包。 這就是我所擁有的...
task receiverJar(type: Jar) {
baseName = "receivers"
from sourceSets.main.output
include 'com/foo/receivers/**'
exclude 'com/foo/cli/**'
exclude 'com/foo/tdl/**'
with jar
}
當我執行gradle receiverJar
我仍然在我的 JAR 文件中獲得所有其他包和類。
task receiverJar(type: Jar) {
enabled = true
baseName this.name + '-receivers'
from sourceSets.main.output
manifest {
attributes 'Implementation-Version': project.version
}
include 'com/foo/tdl/**'
exclude 'com/foo/cdl/**'
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.