【SpringBoot3.x+】热部署在pom.xml的配置更新等解决方案(plugin标签内报红问题解决)
·
在SpringBoot3.x版本在Maven进行热部署时会有fork标签报红问题,报错内容:Element fork is not allowed here以及Parameter 'fork' is unknown for plugin 'spring-boot-maven-plugin:x.x.x:repackage (repackage)'

原因是在2.7版本开始对插件配置上进行了更新,fork标签已经被废弃,3.x版本使用addResources标签启用:


<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>

每次版本更新,学会查询官方文档确定更新内容
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)