Can I remove the 'jar' task in gradle build?

前端 未结 2 1419
旧时难觅i
旧时难觅i 2021-01-19 03:02

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

相关标签:
2条回答
  • 2021-01-19 03:22

    This worked for me:

    configurations.archives.with {
        artifacts.remove artifacts.find { it.toString().contains("jar") }
    }
    
    0 讨论(0)
  • 2021-01-19 03:33

    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

    0 讨论(0)
提交回复
热议问题