您的位置:首页 >Springboot的spring-boot-maven-plugin导入失败怎么解决
发布于2023-05-12 阅读(0)
扫一扫,手机访问
因为之前换了本地仓库,再打开项目的时候就变成红色了,问题是其他依赖都导好了,只有这个家伙红的刺眼。
找到仓库下的这个文件夹,把里面的文件删掉(或者直接删掉spring-boot-maven-plugin这个文件夹)

在这里刷新,然后就是漫长的等待,网速不好可以再重复此步骤

POM 文件中添加了“org.springframework.boot:spring-boot-maven-plugin”插件。
在添加了该插件之后,当运行“mvn package”进行打包时,会打包成一个可以直接运行的 JAR 文件,使用“Java -jar”命令就可以直接运行。
这在很大程度上简化了应用的部署,只需要安装了 JRE 就可以运行。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <!-- ... --> <packaging>jar</packaging> <!-- ... --> </project>
你还可以指定要执行的类,如果不指定的话,Spring会找有这个【public static void main(String[] args)】方法的类,当做可执行的类。
1,如果你的POM是继承spring-boot-starter-parent的话,只需要下面的指定就行。
<properties> <!-- The main class to start by executing java -jar --> <start-class>com.mycorp.starter.HelloWorldApplication</start-class> </properties>
2,如果你的POM不是继承spring-boot-starter-parent的话,需要下面的指定。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.3.5.RELEASE</version>
<configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
9