Maven 项目多运行环境配置(原创)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven 项目多运行环境配置(原创)相关的知识,希望对你有一定的参考价值。
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>cmdra-project</artifactId> <groupId>com.hz.cmdra</groupId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>cmdra-project-web</artifactId> <packaging>war</packaging> <name>${project.artifactId}</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>com.hz.cmdra</groupId> <artifactId>cmdra-project-service-atom</artifactId> </dependency> </dependencies> <profiles> <!-- 本地 --> <profile> <id>local</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <env>local</env> </properties> </profile> <!-- 开发 --> <profile> <id>dev</id> <properties> <env>dev</env> </properties> </profile> <!-- 预发布 --> <profile> <id>pre</id> <properties> <env>pre</env> </properties> </profile> <!-- 生产 --> <profile> <id>prod</id> <properties> <env>prod</env> </properties> </profile> </profiles> <build> <finalName>cmdra</finalName> <resources> <resource> <directory>src/main/resources</directory> </resource> <resource> <directory>src/main/resources_${env}</directory> <filtering>true</filtering> </resource> </resources> <plugins> <!-- jetty --> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.3.2.v20150730</version> <configuration> <httpConnector> <port>8888</port> </httpConnector> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <executions> <execution> <phase>package</phase> <goals> <goal> war </goal> </goals> <configuration> <classifier> ${env} </classifier> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
以上是关于Maven 项目多运行环境配置(原创)的主要内容,如果未能解决你的问题,请参考以下文章
Idea中单测JunitTest环境运行Maven spring项目profile环境选择