javaspring-bootgradlebuild.gradlespring-boot-gradle-plugin

How to build not executable jar (library) with Spring Boot Gradle Plugin 2.1.*


I'm trying to build a library. I have Spring Boot Gradle Plugin in my build.gradle file:

plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
}

My library without the main class. To prevent 'Main class not configured ...' error I add to build.gradle:

bootRepackage {
enabled = false
}

but got an error:

A problem occurred evaluating root project 'mysuperlibrary'.

Could not find method bootRepackage() for arguments [build_3886uiniuyuorta9lpa9n4f5c$_run_closure3@1975ec48] on root project 'mysuperlibrary' of type org.gradle.api.Project.

All works fine with Spring boot Gradle Plugin 1.5.16 but don't works with 2.1.3.

UPDATE: This plugin I use because without it I can`t resolve testCompile 'org.springframework.boot:spring-boot-starter-test' . When I delete the plugin I can build project bit dependency for test disappears.


Solution

  • Now I'm using spring plugin with 2.1.* version in all my libs. It is necessary to add next before 'dependencies' section:

    bootJar {
        enabled = false
    }
    
    jar {
        enabled = true
    }