工程是java service
使用 maven 、assembly打包
問題: 使用mvn package -P test、mvn package -P prd 打包時,使終打的是默認的配置文件,打不到test.properties\prd.properties文件中去
問題代碼在pom.xml中的配置
<profile> <id>test</id> <build> <filters> <filter>profile.test.properties</filter> </filters> <resources></resources> </build> </profile> |
解決辦法,修改pom.xml中,<resouces></resources>配置屬性文件地址。再運行,就可以根據不同配置文件打包了。
<profile> <id>test</id> <build> <filters> <filter>profile.test.properties</filter> </filters> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build> </profile> |