maven profile实现多环境打包
来源:互联网 发布:淘宝拍卖车辆靠谱吗 编辑:程序博客网 时间:2024/05/01 05:31
项目开发需要有多个环境,一般为开发,测试,预发,正式4个环境,通过maven可以实现按不同环境进行打包部署,命令为:
mvn package -P dev
其中“dev“为环境的变量id, 可以自己定义, 我定义的名称为:dev,sit,uat,prod , 具体在pom.xml中的配置如下:
<properties><package.environment>sit</package.environment></properties><profiles><profile><id>dev</id><properties><package.environment>dev</package.environment></properties></profile><profile><id>sit</id><properties><package.environment>sit</package.environment></properties></profile><profile><id>uat</id><properties><package.environment>uat</package.environment></properties></profile><profile><id>prod</id><properties><package.environment>prod</package.environment></properties></profile></profiles> <build> <finalName>mytest</finalName> <plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><encoding>UTF-8</encoding><source>1.8</source><target>1.8</target> <!-- 指定编译级别,默认1.5 --></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.1.1</version><configuration><archive><addMavenDescriptor>false</addMavenDescriptor></archive><webResources><resource>this is relative to the pom.xml directory<directory>src/main/resources/${package.environment}</directory><targetPath>WEB-INF/classes</targetPath><filtering>true</filtering></resource></webResources></configuration></plugin></plugins><resources><resource><directory>src/main/java</directory><includes><include>**/*.xml</include></includes></resource><resource><directory>src/main/resources</directory><includes><include>**/*.*</include></includes><excludes><exclude>sql/oracle/*.*</exclude><exclude>sql/mysql/init/*.*</exclude><exclude>sit/**/*.*</exclude><exclude>uat/**/*.*</exclude><exclude>prod/**/*.*</exclude></excludes></resource></resources> </build>
0 0
- maven profile实现多环境打包
- maven profile实现多环境打包
- Maven Profile多环境打包
- java学习笔记8 - maven profile实现多环境打包
- java学习笔记8 - maven profile实现多环境打包
- 使用maven profile 实现不同环境打包
- maven通过profile不同,实现环境进行打包
- Maven profile实现多环境配置
- 使用maven profile实现多环境配置
- 使用maven profile指定配置文件打包适用多环境
- Maven profile结合Maven AntRun Plugin实现不同环境配置文件分离打包
- maven 使用maven profile实现多环境可移植构建
- 使用maven profile实现多环境可移植构建
- 使用maven profile实现多环境可移植构建
- 使用maven profile实现多环境可移植构建
- 使用maven profile实现多环境可移植构建
- Maven 整合 spring profile实现多环境自动切换
- 使用maven profile实现多环境可移植构建
- 用shell bash自动化程序
- 使用RMySQL将csv文件数据导入MySQL数据库
- Git Bash配置及Key的提交
- 2016.11.11小练习
- 9G第几天
- maven profile实现多环境打包
- 关于安卓布局优化的几点建议
- 模拟spring IOC,DI,深入理解spring IOC,DI的好处
- 1019 集合论与图论
- 对规则的攻击
- Codevs1995 黑魔法师之门 并查集
- Word插入表目录以及合并表目录
- Android Studio 如何手动更新到最新的gradle,拒绝等待
- Java中String和Int的相互转换