tomcat7-maven-plugin启动读取占位符失败
由于不同环境需要配置不同的配置文件,所以我采用maven-war-plugin插件来解决这个问题,其中使用了占位符。打包是没有问题,可以分环境做打包。
但是本地运行项目我们是采用tomcat7-maven-plugin启动的,此时控制台会在打包操作中报占位符错误。
请大侠们帮忙提供一下思路,注:项目不能启动热部署tomcat插件启动,只能依赖tomcat-maven-plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/ui</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/ui/${package.environment}</directory>
<targetPath>/</targetPath>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
报错信息:
[INFO] Copying webapp webResources [E:\workspace\hxxyz-source\src/main/ui] to [E:\workspace\hxxyz-source\target\hxxyz]
[INFO] Copying webapp webResources [E:\workspace\hxxyz-source\src/main/ui/${package.environment}] to [E:\workspace\hxxyz-source\target\hxxyz]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:55 min
[INFO] Finished at: 2018-03-23T14:41:49+08:00
[INFO] Final Memory: 178M/504M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project his-mvn: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed: basedir E:\workspace\hxxyz-source\src\main\ui\${package.environment} does not exist -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException