Spring Boot No Main Manifest Attribute, In


You have created a ./target/.jar and have tried to run it using java -jar <app>.jar yet receive a spring boot no main manifest attribute, in <app>.jar error.

Good thing is that this is really easy to solve!

You can generate your jar as follows instead:

mvn package spring-boot:repackage

Or you could adjust your pom.xml so that you can generate your jar using a simple mvn package:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <mainClass>com.example.Main</mainClass>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Another option is to specify the following parent POM:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.4.RELEASE</version>
</parent>