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支持多环境编译的更多相关文章

  1. 使用maven profile实现多环境可移植构建(转自CSDN)

    使用maven profile实现多环境可移植构建 标签: maven profilemaven自动构建maven自动部署maven可移植构建持续集成 2014-04-25 23:37 26905人阅 ...

  2. 使用Maven Profile实现多环境构建

    在开发过程中,我们的软件会面对不同的运行环境,比如开发环境.测试环境.生产环境,而我们的软件在不同的环境中,有的配置可能会不一样,比如数据源配置.日志文件配置.以及一些软件运行过程中的基本配置,那每次 ...

  3. 使用maven profile实现多环境可移植构建

    mvn clean package -Pproduction即构建出生产环境需要的war包 mvn tomcat:redeploy -Ptest 即发布到测试环境 在开发过程中,我们的软件会面对不同的 ...

  4. maven profile实现多环境打包

    快速解决: 项目目录 1.pom文件中添加profile <profiles> <profile> <!-- 本地开发环境 --> <id>dev< ...

  5. 通过maven profile 打包指定环境配置

    背景 最近换了个新公司接手了一个老项目,然后比较坑的是这个公司的项目都没有没有做多环境打包配置,每次发布一个环境都要手动的去修改配置文件.今天正好有空就来配置下. 解决这个问题的方式有很多,我这里挑选 ...

  6. maven profile实现多环境配置

    每次项目部署上线都需要手动去修改配置文件(比如数据库配置,或者一个自定义的配置)然后才能打包,很麻烦,网上找到 maven profile可以完成这个工作,记录如下: 环境:eclipse + spr ...

  7. Maven profile 打包分环境加载不同的资源文件

    在实际开发项目中,常常有几种环境,一般情况下最少有三种环境:开发.测试.正式. 各个环境之间的参数各不相同,比如mysql.等不同环境的host不一样,若每个环境都手动替换环境很容易出错,这里我们利用 ...

  8. 【转】maven profile实现多环境打包

    作为一名程序员,在开发的过程中,经常需要面对不同的运行环境(开发环境.测试环境.生产环境.内网环境.外网环境等等),在不同的环境中,相关的配置一般不一样,比如数据源配置.日志文件配置.以及一些软件运行 ...

  9. maven profile切换正式环境和测试环境

    有时候,我们在开发和部署的时候,有很多配置文件数据是不一样的,比如连接mysql,连接redis,一些properties文件等等 每次部署或者开发都要改配置文件太麻烦了,这个时候,就需要用到mave ...

随机推荐

  1. netty服务端实现心跳超时的主动拆链

    一.服务器启动示例: public class MySocketServer { protected static Logger logger = LoggerFactory.getLogger(My ...

  2. Android长度单位详解(dp、sp、px、in、pt、mm、dip)

    Android中定义的dimension单位有以下这些:px(Pixels ,像素):对应屏幕上的实际像素点.in(Inches ,英寸):屏幕物理长度单位.mm(Millimeters ,毫米):屏 ...

  3. jmeter 插件下载下载方法

    1.进入下载插件网页:https://jmeter-plugins.org/install/Install/ 下载plugin-manager.jar 并放在jmeter 的lib/ext文件夹下 2 ...

  4. unity, Animator.ResetTrigger

    解: 正确的写法应该是:Animator.SetTrigger("unfoldTrigger")Animator.ResetTrigger("unfoldTrigger& ...

  5. OpenXml SDK 2.0 创建Word文档 添加页、段落、页眉和页脚

    using (WordprocessingDocument objWordDocument = WordprocessingDocument.Create(@"C:\********.doc ...

  6. MySQL 5.6学习笔记(查询数据、插入、更新、删除数据)

    1. 查询语法 SELECT {*|<字段列表>} [FROM table_references [WHERE where_condition] [GROUP BY {col_name | ...

  7. 关于https中的算法

    1,对称加密算法,是指加密和解密使用相同的密钥,典型的算法有RSA,DSA,DH 2,非对称加密算法:又称为公钥加密算法,是指加密和解密使用不同的密钥,公共的公钥用于加密,私钥用于解密,比如第一次请求 ...

  8. 每天一个linux命令(6):dos2unix unix2dos

    dos2unix是将Windows格式文件转换为Unix.Linux格式的实用命令.Windows格式文件的换行符为\r\n ,而Unix&Linux文件的换行符为\n. dos2unix命令 ...

  9. 【Android】OAuth验证和新浪微博的oauth实现

    关于OAuth验证 OAuth是当下流行的授权方案,twitter,facebook,google等大型网站的开放平台都支持了oauth验证模式,国内的新浪微博.腾讯微博.163微博的开放平台也相继支 ...

  10. Python(七)之OS模块

    文件系统功能:os模块 python编程时,经常和文件.目录打交道,这是就离不了os模块.os模块包含普遍的操作系统功能,与具体的平台无关.以下列举常用的命令: 目录: os.mkdir('/tmp/ ...