CAS (13) —— CAS 使用Maven Profile支持多环境编译
CAS (13) —— CAS 使用Maven Profile支持多环境编译
摘要
CAS 使用Maven Profile支持多环境编译
版本
tomcat版本: tomcat-8.0.29
jdk版本: jdk1.8.0_65
cas版本: 4.1.3
**cas4.1.3 (4.x还在开发过程中不是很稳定,迭代比较快,也会有些bug) **
cas-client-3.4.1
maven版本: 3.3.9
主要内容
准备
以项目github上CAS项目为例进行扩充
- 参考文章
CAS (1) —— Mac下配置CAS到Tomcat(服务端)
配置
扩充不同环境下需要定制配置文件目录
Profile使用
<profiles>
<profile>
<id>local8433</id>
<properties>
<env>local8433</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/local8433</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>local8443</id>
<properties>
<env>local8443</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/local8443</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>local</id>
<properties>
<env>local</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/local</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/dev</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>qa</id>
<properties>
<env>qa</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/qa</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/prod</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>prod215</id>
<properties>
<env>prod215</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/prod215</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>prod216</id>
<properties>
<env>prod216</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.bak</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources-config/prod216</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
Filter使用
<build>
<filters>
<filter>${basedir}/src/main/webapp-config/${env}/filters/cas.properties</filter>
<!--<filter>${basedir}/src/main/webapp-config/${env}/filters/spring-configuration/ticketRegistryDataSource.xml</filter>-->
<!--<filter>${basedir}/src/main/webapp-config/${env}/filters/spring-configuration/authenticationDataSource.xml</filter>-->
<filter>${basedir}/src/main/webapp-config/${env}/filters/spring-configuration/authenticationEncoder.xml</filter>
</filters>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>cas</warName>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
<includes>
<include>**/web.xml</include>
</includes>
<excludes>
<exclude>**.bak</exclude>
</excludes>
</resource>
<resource>
<directory>${basedir}/src/main/webapp-config/${env}/filters</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
<includes>
<include>*.properties</include>
<include>**.xml</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/webapp-config/${env}/filters/spring-configuration</directory>
<filtering>true</filtering>
<targetPath>WEB-INF/spring-configuration</targetPath>
<includes>
<include>*.properties</include>
<include>**.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${maven-jetty-plugin.version}</version>
<configuration>
<webApp>
<contextPath>/cas</contextPath>
</webApp>
</configuration>
</plugin>
</build>
参考
Introduction to Build Profiles
CAS (7) —— Mac下配置CAS 4.x集群及JPATicketRegistry
结束
CAS (13) —— CAS 使用Maven Profile支持多环境编译的更多相关文章
- 使用maven profile实现多环境可移植构建(转自CSDN)
使用maven profile实现多环境可移植构建 标签: maven profilemaven自动构建maven自动部署maven可移植构建持续集成 2014-04-25 23:37 26905人阅 ...
- 使用Maven Profile实现多环境构建
在开发过程中,我们的软件会面对不同的运行环境,比如开发环境.测试环境.生产环境,而我们的软件在不同的环境中,有的配置可能会不一样,比如数据源配置.日志文件配置.以及一些软件运行过程中的基本配置,那每次 ...
- 使用maven profile实现多环境可移植构建
mvn clean package -Pproduction即构建出生产环境需要的war包 mvn tomcat:redeploy -Ptest 即发布到测试环境 在开发过程中,我们的软件会面对不同的 ...
- maven profile实现多环境打包
快速解决: 项目目录 1.pom文件中添加profile <profiles> <profile> <!-- 本地开发环境 --> <id>dev< ...
- 通过maven profile 打包指定环境配置
背景 最近换了个新公司接手了一个老项目,然后比较坑的是这个公司的项目都没有没有做多环境打包配置,每次发布一个环境都要手动的去修改配置文件.今天正好有空就来配置下. 解决这个问题的方式有很多,我这里挑选 ...
- maven profile实现多环境配置
每次项目部署上线都需要手动去修改配置文件(比如数据库配置,或者一个自定义的配置)然后才能打包,很麻烦,网上找到 maven profile可以完成这个工作,记录如下: 环境:eclipse + spr ...
- Maven profile 打包分环境加载不同的资源文件
在实际开发项目中,常常有几种环境,一般情况下最少有三种环境:开发.测试.正式. 各个环境之间的参数各不相同,比如mysql.等不同环境的host不一样,若每个环境都手动替换环境很容易出错,这里我们利用 ...
- 【转】maven profile实现多环境打包
作为一名程序员,在开发的过程中,经常需要面对不同的运行环境(开发环境.测试环境.生产环境.内网环境.外网环境等等),在不同的环境中,相关的配置一般不一样,比如数据源配置.日志文件配置.以及一些软件运行 ...
- maven profile切换正式环境和测试环境
有时候,我们在开发和部署的时候,有很多配置文件数据是不一样的,比如连接mysql,连接redis,一些properties文件等等 每次部署或者开发都要改配置文件太麻烦了,这个时候,就需要用到mave ...
随机推荐
- 如何提升RDS响应速度
如果采用短连接的方式连接RDS,请在与RDS相连的云服务器上执行以下命令来提升RDS响应速度.(注:云服务器要有公网带宽) 1.安装nscd 云服务器上执行命令 Ubuntu系统执行:apt-get ...
- FreeSWITCH协议参数之自定义sip header
一.主动发送 1. 加入sip_h_前缀 这样FreeSWITCH就能自动加上后面的扩展头. 2. 示例 <action application="set" data=&qu ...
- stm8 时钟输出引脚
CLK_CCO引脚是STM8的时钟输出引脚,若设置该脚输出主时钟Fmaster,时钟输出寄存器可以进行如下操作 CLK->CCOR=0X19;
- [转]springSecurity源码分析—DelegatingFilterProxy类的作用
使用过springSecurity的朋友都知道,首先需要在web.xml进行以下配置, <filter> <filter-name>springSecurityFilterC ...
- Gituhb 上一些值得攻读的玩具代码库
https://github.com/sindresorhus/globby https://github.com/dylansmith/node-exif-renamer https://githu ...
- 修改eclipse.ini文件指定jdk
在eclipse.ini文件顶部插入 -vmE:/kfgj/Java/jdk1.7.0_21/bin/javaw.exe
- Flowable 的event介绍
1 事件分为两种,一种是抛出:当流程执行到这时,抛出一个事件:另一种是捕获:当流程执行到这时,他就会等待一个事件的发生. 一个事件需要有事件定义,否则不会做任何“特殊”的事.对于一个流程实例,一个开始 ...
- Vuex 实践讲解
state 用来数据共享数据存储 mutation 用来注册改变数据状态 getters 用来对共享数据进行过滤操作 action 解决异步改变共享数据 这个四大特征就是核心,如何用怎么用 接下来还是 ...
- 进程process与线程thread
进程:process是一个外理过程,即然是外理过程,那么它就有生命周期,从进程的启动,运行,直到运行结束,进程终止.进程是程序的执行实例,即运行中的程序,同时也是程序的一个副本,程序是放置于磁盘的,而 ...
- nodejs文件上传报错总结
语法: fs.rename(oldPath,newPath,callback) 今天在使用formidable模块做图片上传处理的时候,fs.rename方法的报了一个这样的错:cross-devic ...