使用maven在不同环境下设置properties文件的值

有这样一个需求,在使用maven部署项目时,项目中properties文件的某些变量需要根据不同的环境(测试,线上)设置不同的值。

1. property文件
    resources.static.host=${resources.static.host}

2. pom文件

<build>
   <resources>
        <resource>
             <directory>src/main/resources</directory>
                      *** property文件目录  ****
             <filtering>true</filtering>
        </resource>
    </resources>
            ....
        </build>
        <profiles>
             <profile>
           <id>production</id>
           <properties>
<resources.static.host>xxxxxxxx.</resources.static.host>
            </properties>
             </profile>
        </profiles>

猜你喜欢

转载自rhuichao.iteye.com/blog/1976588