在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>
每次版本更新,学会查询官方文档确定更新内容