问题
I am doing gradle build, which includes a number of projects. When i run
gradle build
command its generating unwanted bundles like tar,zip. So what should i do to exclude these tasks
am using war plugin to generate war ( apply plugin: 'war'
).
am also using following plugins
apply plugin: 'spring-boot'
apply plugin: 'org.asciidoctor.gradle.asciidoctor'
apply plugin: 'war'
am also using plugin asciidoctor
UPDATE
I have used
distTar.enabled = false
distZip.enabled = false
To solve this, but When i try to upload with
gradle upload
Its giving the following error
> Could not publish configuration 'archives'
回答1:
You are running the build
task, which is defined in the java
plugin of Gradle and is one of the lifecycle tasks. According to documentation, build
task depends on check
and assemble
tasks and performs a full build of the project.
Since check
task performs all verification tasks in the project and assemble
assembles all the archives in the project, you've got this behaviour, when all the task are executed.
If you want to provide some specific task execution order, which will include only subset of all tasks, you can simply do not use the build
task, but provide your own custom task or just call some exactly task (for example war
), which will do, what you want. Furthermore, you are free to specify the execution order with dependsOn
and mustRunAfter
properties of the tasks if it's needed.
来源:https://stackoverflow.com/questions/33755385/unwanted-tar-zip-jar-disributions-in-gradle-build