在使用SpringBoot完成项目,将项目打成jar包传送到Linux服务器使用命令nohup java -jar ~.jar &
运行时出现错误No main manifest attribute, in ~.jar
,后来查找了一下文档是在SpringBoot的pom文件插件中配置不行,将Maven中的打包插件换成以下即可解决问题:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>true</includeSystemScope>
<mainClass>com.**.**Main</mainClass> <!--这里是你的主函数全限定类名-->
</configuration>
</plugin>