Spring Boot 2 Gradle plugin without executable jar

前端 未结 5 2678
感情败类
感情败类 2021-02-19 19:56

How do I configure Spring Boot Gradle plugin 2 to disable the Boot distribution in Gradle Script Kotlin.

The distribution i want is a assembly bundle zip with all depend

5条回答
  •  余生分开走
    2021-02-19 20:31

    In spring-boot 2, the gradle plugin reconfigures the build to include the boot tar and zip distributions in the uploadArchives task when you apply the application and maven plugins.

    From what I can tell from your question, you want a single zip-file with all the jar files in it, similar to what the application plugin creates, but want to exclude everything "extra" that the spring boot plugin adds? If that is the case it is a simple matter of telling gradle to do exactly that;

    apply plugin: 'application'
    apply plugin: 'maven'
    
    jar.enabled = true
    [bootJar, distTar, bootDistTar, bootDistZip]*.enabled = false
    configurations.archives.artifacts.removeIf { !it.archiveTask.is(distZip) }
    

    This is groovy, but hopefully you are able to apply this in a similar way in your kotlin file.

提交回复
热议问题