spring boot 程序在本地运行一直没问题
最近需要在服务器部署,发现变成docker 后会报错:
no main manifest attribute spring-boot
在网上搜了好久试了好多方法没解决,最后终于Google中找到方法
特此记录:
1.pom 文件中增加plugin
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.baeldung.demo.DemoApplication</mainClass>
<layout>JAR</layout>
</configuration>
</plugin>
</plugins>
2.网上大多数只有这一步,但是对于我并没有解决,于是还需要:
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
and(我是加了这一句立马解决了)
<properties>
<start-class>com.baeldung.demo.DemoApplication</start-class>
</properties>