打了一个包,一开始没注意大小只有几十kb,直接扔到服务器上去运行,报错:No main manifest attribute, in XXX.jar
,这个问题百度翻译为没有主清单属性,然后去看pom文件,发现没有主程序入口,添加如下内容:
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<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>到启动类的目录,写到启动类,例如xxx.xxx.xxApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>