Spring Boot Thin Jar with Gradle not working

841 views Asked by At

I tried to switch to a Spring Boot thin jar so that the dependencies are not included in the jar. I am using the thin-launcher gradle plugin:

plugins {
    id 'org.springframework.boot.experimental.thin-launcher' version '1.0.25.RELEASE'
}

However, I am getting the following error message when running the thinJar task:

The value of a manifest attribute must not be null (Key=Start-Class).

I tried to specify the Start-Class attribute in several ways:

thinJar {
    manifest {
        attributes 'Start-Class': "at.mypackage.Application"
    }
}

bootJar {
    manifest {
        attributes 'Start-Class': "at.mypackage.Application"
    }
}

Using the gradle application plugin and specifying the mainClassName property does not work either. Without the thin jar plugin, everything works as expected.

Thanks for your help!

1

There are 1 answers

0
Thomas K. On

Update 2021-02-27: The issue got resolved with PR #164. It's now compatible with Gradle 6.8.x.

Original answer: It looks like you're affected by issue #149 - "Getting an error about missing the value of a manifest attribute (Start-Class)". There's no solution at the time of writing this answer. The project maintainers are asking for help.

Workarounds mentioned:

  1. Use Gradle 5
  2. Use Gradle 6.0.1 - that's what the simple example is using