1.在cmd下,输入路径

2.输入
mvn clean package
3.报错Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7
4.在pom.xml中删除红色框部分
5.输入 java -jar springbootthymeleaf-0.0.1-SNAPSHOT.jar
报错,没有告诉程序啦个作为程序入口
在pom.xml添加依赖,并更新
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.shs.APP</mainClass>
<excludes>
<exclude>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclude>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
这个部分改为自己的东西

6.重新打包,输入



在命令行环境下,尝试使用mvncleanpackage命令打包项目时遇到错误。问题出在spring-boot-maven-plugin插件上。解决方案是删除pom.xml中特定的红色标记部分,然后指定主类为com.shs.APP,排除junit和spring-boot-starter-test依赖。更新配置后重新打包,但运行jar文件时仍报错,需确保指定了正确的程序入口。





3760

被折叠的 条评论
为什么被折叠?



