解决 cmd 运行spring boot项目提示没有主清单属性
在编写dockerfile文件中最后的CMD命令报错,把命令拿出来单独跑了一下,发现是打包的时候没有配置主类
百度了一下,解决方案如下所示:https://blog.csdn.net/weixin_49736959/article/details/108969870
cmd中运行提示如下:

在pom.xml中配置以下属性即可
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.6.RELEASE</version>
<configuration>
<executable>true</executable>
<mainClass>org.test.application</mainClass>
</configuration>
</plugin>
</plugins>
</build>
其中mainClass 标签填写spring boot的启动类,配置完毕后重新打包编译运行就解决问题了。

浙公网安备 33010602011771号