maven的多环境配置
<profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <env>dev</env> </properties> </profile> <profile> <id>test</id> <properties> <env>test</env> </properties> </profile> <profile> <id>prod</id> <properties> <env>prod</env> </properties> </profile> </profiles> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin><!--编译插件--> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <compilerArguments> <verbose /> <bootclasspath>${java.home}/lib/rt.jar</bootclasspath> </compilerArguments> </configuration> </plugin> </plugins> <resources> <resource> <directory>${project.basedir}/src/main/resources</directory> <excludes> <exclude>environment/dev/*</exclude> <exclude>environment/test/*</exclude> <exclude>environment/prod/*</exclude> </excludes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources/environment/${environment}</directory> <targetPath>environment/${environment}</targetPath> </resource> </resources> </build>
maven的多环境配置