直接 在 pom 文件中添加 以下 插件:
-
<build>
-
<plugins>
-
<plugin>
-
<groupId>org.springframework.boot</groupId>
-
<artifactId>spring-boot-maven-plugin</artifactId>
-
</plugin>
-
-
<plugin>
-
<groupId>org.apache.maven.plugins</groupId>
-
<artifactId>maven-jar-plugin</artifactId>
-
<configuration>
-
<outputDirectory>${project.build.directory}</outputDirectory>
-
<excludes>
-
<exclude>application-dev.yml</exclude>
-
<exclude>application-prod.yml</exclude>
-
<exclude>application.yml</exclude>
-
</excludes>
-
</configuration>
-
</plugin>
-
<!--<!– maven资源文件复制插件 –>-->
-
<plugin>
-
<groupId>org.apache.maven.plugins</groupId>
-
<artifactId>maven-resources-plugin</artifactId>
-
<version>3.1.0</version>
-
<executions>
-
<execution>
-
<id>copy-resources</id>
-
<!-- here the phase you need -->
-
<phase>package</phase>
-
<goals>
-
<goal>copy-resources</goal>
-
</goals>
-
<configuration>
-
<outputDirectory>${project.build.directory}</outputDirectory>
-
<resources>
-
<resource>
-
<directory>src/main/resources</directory>
-
<includes>
-
<exclude>application-dev.yml</exclude>
-
<exclude>application-prod.yml</exclude>
-
<exclude>application.yml</exclude>
-
</includes>
-
<filtering>true</filtering>
-
</resource>
-
</resources>
-
<encoding>UTF-8</encoding>
-
</configuration>
-
</execution>
-
</executions>
-
</plugin>
-
</plugins>
-
</build>
执行 mvn clean package -DskipTests 命令 即可
文章来源: blog.csdn.net,作者:血煞风雨城2018,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/qq_31905135/article/details/89227622