1、配置profile
这里定义了三个环境,分别是development(开发环境)、test(测试环境)、production(生产环境),其中开发环境是默认激活的(activeByDefault为true),这样如果在不指定profile时默认是开发环境。
同时每个profile还定义了两个属性,其中profiles.active表示被激活的profile的名称,deploy.url表示发布服务器的地址。我们需要在下面使用到这两个属性。
另外host和port分别是发布服务器的主机地址和端口号。
首先是profile配置,在pom.xml中添加如下profile的配置:
<profiles><!-- 本地开发环境 --><profile>
<id>development</id>
<properties>
<profiles.active>development</profiles.active>
</properties>
</profile><!-- 测试环境 --><profile>
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
</properties>
</profile>
<!-- 生产环境136 --><pr