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 ...
随机推荐
- ss 命令
ss命令用来显示处于活动状态的套接字信息.ss命令可以用来获取socket统计信息,它可以显示和netstat类似的内容.但ss的优势在于它能够显示更多更详细的有关TCP和连接状态的信息,而且比net ...
- 最优化方法:共轭梯度法(Conjugate Gradient)
http://blog.csdn.net/pipisorry/article/details/39891197 共轭梯度法(Conjugate Gradient) 共轭梯度法(英语:Conjugate ...
- [转]如何在Windows 10中更改文件夹背景颜色
ini文件.我们甚至可以使用相同的技术将图片设置为文件夹背景. 已有工具可以更改Windows 7中Windows资源管理器背景的颜色,并将图像设置为Windows 7中的文件夹背景,但这些工具与Wi ...
- [转]session和cookie的区别和联系,session的生命周期,多个服务部署时session管理
Session和Cookie的区别 对象 信息量大小 保存时间 应用范围 保存位置 Session 小量,简单的数据 用户活动时间+一段延迟时间(一般为20分钟) 单个用户 服务器端 Cookie 小 ...
- 最强 Android Studio 使用小技巧和快捷键总结
最强 Android Studio 使用小技巧和快捷键总结 写在前面 本文翻译自 Android Studio Tips by Philippe Breault,一共收集了62个 Android ...
- yml配置文件
1 yaml配置文件中是以空格来区分是否是同一层级.在键值对的冒号之后要有空格. 2 属性值:数值.字符串.bool 值,直接写即可.双引号会将特殊字符进行转义,例如:"nice \n go ...
- HTML常用标签(整理)
超文本标记语言,即HTML(Hypertext Markup Language),是用于描述网页文档的一种标记语言.现在应用主流是HTML 4.01版本,发布于1999年,为W3C推荐标准.HTML ...
- AlloyTouch全屏滚动插件搞定顺滑H5页
使用姿势 在设计全屏滚动插件的时候,希望开发者几乎: 不用写任何脚本快速生成精致H5 支持PC滚轮和移动触摸 酷炫的转场动效 灵活的时间轴管理 一切皆可配置 但是不写脚本肯定没有灵活性咯?!不是的.这 ...
- View:Android View的scrollTo(),scrollBy(),getScrollX(), getScrollY()的理解
Android系统手机屏幕的左上角为坐标系,同时y轴方向与笛卡尔坐标系的y轴方向想反.提供了 getLeft(), getTop(), getBottom(), getRight() 这些API来获取 ...
- (原创)C++11改进我们的程序之简化我们的程序(五)
这次要讲的是:c++11中的bind和function std::function 它是函数.函数对象.函数指针.和成员函数的包装器,可以容纳任何类型的函数对象,函数指针,引用函数,成员函数的指针.以 ...