不需要的焦油,拉链,罐头碎片在gradle构建 [英] unwanted tar,zip,jar disributions in gradle build

查看:174
本文介绍了不需要的焦油,拉链,罐头碎片在gradle构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做Gradle构建,其中包括许多项目。当我运行
gradle build
时,它会生成不需要的捆绑包,例如tar,zip。那么我应该怎么做才能排除这些任务?



正在使用war插件生成战争( apply plugin:'war')。
也使用以下插件

  apply plugin:'spring-boot'
apply plugin:'org .asciidoctor.gradle.asciidoctor'
apply plugin:'war'

我也使用插件 asciidoctor



更新

我曾用过

  distTar.enabled = false 
distZip.enabled = false

为了解决这个问题,但是当我尝试上传时,

  gradle upload 

它给出以下错误

 >无法发布配置'archives'


解决方案

build 任务,它是在Gradle的 java 插件中定义的,并且是生命周期任务之一。根据文档 build 任务取决于检查汇编任务,并执行项目的完整构建。
$ b

由于检查任务执行项目中的所有验证任务,并且 assemble 汇编项目中的所有存档,当执行完所有任务时,就会出现这种行为。



如果您想提供某些特定的任务执行顺序,它将只包含所有任务的子集,您可以简单地不使用 build 任务,但是提供您自己的自定义任务或者只调用一些完全的任务(例如 war ),这样做,你想要什么。此外,如果需要,您可以自由指定任务的执行顺序( dependsOn mustRunAfter 属性)。


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'

解决方案

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.

这篇关于不需要的焦油,拉链,罐头碎片在gradle构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆