Maven 根据不同的环境使用不同的配置
Posted BINGJJFLY
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven 根据不同的环境使用不同的配置相关的知识,希望对你有一定的参考价值。
pom文件配置
<profiles> <profile> <id>dev</id> <properties> <profile.id>dev</profile.id> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>test</id> <properties> <profile.id>test</profile.id> </properties> </profile> <profile> <id>preonline</id> <properties> <profile.id>preonline</profile.id> </properties> </profile> <profile> <id>online</id> <properties> <profile.id>online</profile.id> </properties> </profile> </profiles> <build> <finalName>middlewares</finalName> <resources> <resource> <directory>src/main/resources/env</directory> <includes> <include>global/*</include> </includes> </resource> <resource> <directory>src/main/resources/env</directory> <includes> <include>${profile.id}/*</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>prepare-war</id> <phase>prepare-package</phase> <goals> <goal>exploded</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
配置文件结构
配置文件配置
converter.packageName=${converter.packageName}
以上是关于Maven 根据不同的环境使用不同的配置的主要内容,如果未能解决你的问题,请参考以下文章
SpringBoot项目使用maven-assembly-plugin根据不同环境打包成tar.gz