Skip to content
Latchkey

Spring Boot "no main manifest attribute" running the jar in CI

The jar you ran has no Main-Class in its manifest. This happens when CI runs the plain library jar instead of the repackaged executable Spring Boot jar produced by bootJar or spring-boot:repackage.

What this error means

A java -jar step fails with "no main manifest attribute, in build/libs/app.jar" and exits immediately.

Spring Boot
no main manifest attribute, in build/libs/app-0.0.1-SNAPSHOT-plain.jar

Common causes

The plain jar was run, not the bootJar

Gradle produces both an executable jar and a -plain.jar; running the plain one has no launcher manifest.

Repackaging did not run

With Maven, the app was packaged without the spring-boot-maven-plugin repackage goal, so the jar is not executable.

How to fix it

Run the executable bootJar

Point java -jar at the repackaged jar, not the -plain one.

Terminal
./gradlew bootJar
java -jar build/libs/app-0.0.1-SNAPSHOT.jar

Ensure Maven repackages the jar

Include the Spring Boot plugin so mvn package produces an executable jar.

pom.xml
<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

How to prevent it

  • Run the bootJar/repackaged artifact, never the -plain jar.
  • Keep the Spring Boot build plugin configured so repackaging happens.
  • Name the artifact explicitly in the run step to avoid picking the wrong jar.

Frequently asked questions

What causes ""no main manifest attribute""?
Gradle produces both an executable jar and a -plain.jar; running the plain one has no launcher manifest.
How do I fix "no main manifest attribute"?
Point java -jar at the repackaged jar, not the -plain one.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card