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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →