我如何告诉gradle不要构建sources.jar和javadoc.jar?

时间:2018-03-22 12:13:24

标签: gradle jar

我有非常简单的构建jar的build.properties,以及sources.jat = r和javadoc.jar

我不想要最后两个,它会减慢构建速度。

如何告诉gradle NOT不要构建sources.jar和javadoc.jar?

buildscript {

}

group 'com.premierinc.gporev'
version '1.0.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'maven'

jar {
    baseName = 'gporev-pentaho'
}


jar {
    into 'resources', {
        from 'resources'
    }
}

// added so Bamboo can extract the GAV variables
// and pass them on
task ('createPom')  {
    doLast {
        pom {}.writeTo("pom.xml")
    }
}

clean.doLast { file("pom.xml").delete() }
build.finalizedBy createPom

1 个答案:

答案 0 :(得分:0)

选项

  1. 首先不要将javadocJarsourcesJar任务添加到gradle模型中
  2. 禁用任务(可能基于某些属性)
  3. apply plugin: 'java'
    task javadocJar(type:Jar) { ... }
    task sourcesJar(type:Jar) { ... }
    if (someMagicFlag) {
        javadocJar.enabled = false
        sourcesJar.enabled = false
    }