我可以删除Gradle构建中的'jar'任务吗? [英] Can I remove the 'jar' task in gradle build?

查看:332
本文介绍了我可以删除Gradle构建中的'jar'任务吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  apply plugin'java'$ 

使用下面的代码时,会生成一个jar文件。 b $ b

是否有任何设置不会生成jar文件?



我可以编写一个自定义插件,但下面的代码是错误的。

 依赖关系{
编译项目(':crm.common')
testCompile组:'junit',名称:'junit',版本:'4.12'
}

我想要找到一种不会生成jar文件的方法。
并且可以在依赖关系中运行编译。
有什么办法可以做到吗?


  1. 从执行中明确排除 jar 任务:
    gradle build -x jar


  2. 禁用 jar build.gradle

    应用插件:'java'
    中的
    任务jar.enabled = false



When I use the code below, a file of jar will generate after gradle build.

apply plugin 'java'

Is there any settings won't generate the file of jar??

I can write a custom plugins,but the code below was wrong.

dependencies {
    compile project(':crm.common')
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

I want find a way that donot generate the file of jar. And can run compile in dependencies. Is there any way can do that???

解决方案

You can do that by 2 ways:

  1. explicitly exclude the jar task from execution: gradle build -x jar

  2. disable the jar task in build.gradle: apply plugin: 'java' jar.enabled = false

这篇关于我可以删除Gradle构建中的'jar'任务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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