Maven Profile 资源插件配置问题
当 Maven Profile 下的资源插件配置不生效时,请检查 pom.xml 中的插件定义。
解决方案
参考以下配置片段,确保插件版本、执行阶段及资源路径设置正确:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
注意验证阶段与资源过滤选项是否匹配当前构建需求。
