Spring Boot no main manifest attribute, in

You have created a ./target/<app>.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>
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments