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:
1
|
mvn package spring-boot:repackage
|
Or you could adjust your pom.xml so that you can generate your jar using a simple mvn package
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<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:
1
2
3
4
5
|
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
</parent>
|