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.
no main manifest attribute, in build/libs/app-0.0.1-SNAPSHOT-plain.jarCommon 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.
./gradlew bootJar
java -jar build/libs/app-0.0.1-SNAPSHOT.jarEnsure Maven repackages the jar
Include the Spring Boot plugin so mvn package produces an executable jar.
<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.