Run on the server:
java -jar test-0.0.1-SNAPSHOT.jar
Error:
no main manifest attribute, in test-0.0.1-SNAPSHOT.jar
the reason:
The reason is that the main class cannot be found.
In general, to package java into a jar package, you need to specify the Main-Class item in MANIFEST.MF so that the corresponding main class can be found when running java -jar xxx.jar.
After decompressing test-0.0.1-SNAPSHOT.jar,
check the MANIFEST.MF under META-INF
The normal one should look like this:
solve:
After investigation, it was found that the pom.xml
in the maven project was not added
<packaging>jar</packaging>
Also don't forget spring-boot-maven-plugin
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
After adding these two, just pack and run.