创建文件夹
添加向pom文件中的构建参数中添加配置
修改原有配置文件使其变成动态的
POM文件
<build>
<!--项目名称-->
<finalName>poject_name</finalName>
<plugins>
<!--install阶段跳过test步骤的方法-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!--打包插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!--Jetty插件-->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.8.v20150217</version>
<configuration>
<httpConnector>
<!--端口号-->
<port>10032</port>
</httpConnector>
<!--热部署2秒刷新一次-->
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
<resources>
<!-- 资源文件目录 -->
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- 需要根据不同环境替换的配置 -->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>src/main/filters/${deploy.env}/config.properties</filter>
</filters>
</build>
线上配置文件
测试配置文件