簡體   English   中英

使用 Gradle 從自定義 Jar 中排除編譯源

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM