maven 的profile  可以是我们通过编译时指定 -P 来实现 使用不同的 属性变量。

比如:

 <profiles>
<profile>
<id>local</id>
<properties>
<xx>我是local环境的xx的值</xx>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<xx>我是dev的xx的值</xx>
</properties>
</profile>
</profiles>

xx 等同于属性值

<properties>
<xx>fdsfdsfds</xx>
</properties>

但是 这个时候 有了指定不同 -P 使用不同配置的功能。

所有在maven pom 文件中 可配置的 参数都可以 通过这种方式 配置 不同场景下使用不同的 参数。

比如: 可以使用profiles 配置不同镜像地址 。 这样就可以区分仓库了。

注意事项: maven 的 setting.xml  和  项目 pom.xml 中配置的  profile 会同时存在。在 -P 的时候可以使用多个 如:  -P  dev, devParam   逗号分割

  <profile>
<id>dev</id>
<repositories>
<repository>
  <id>central</id>
    <name>Central</name>
    <url>http://url/repository/maven-public</url>
    <releases>
    <enabled>true</enabled>
    </releases>
    <snapshots>
    <enabled>true</enabled>
    </snapshots>
  </repository>
   </repositories>
</profile>
  <profile>
    <id>uat</id>
    <repositories>
    <repository>
    <id>central</id>
    <name>Central</name>
    <url>http://url/repository/maven-public</url>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
    <enabled>true</enabled>
    </snapshots>
    </repository>
  </repositories>
</profile>
</profiles> <activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>

maven profile 的作用的更多相关文章

  1. 项目实现不同环境不同配置文件-maven profile

    最近接触的项目都是在很多地方都落地的项目,需要支持不同的环境使用不同的配置文件.一直以来都以为是人工的去写不同的配置文件,手动的去修改运用的配置文件.感觉自己还是太low呀.maven的使用的还停留在 ...

  2. maven profile实现多环境打包

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

  3. maven profile实现多环境配置

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

  4. 在eclipse激活maven profile配置

    profile简介 profile可以让我们定义一系列的配置信息,然后指定其激活条件.这样我们就可以定义多个profile,然后每个profile对应不同的激活条件和配置信息,从而达到不同环境使用不同 ...

  5. 记录一次诡异的Maven Profile不生效的问题

    记录一次诡异的Maven Profile不生效的问题 现象 maven 打包之后,复制的 profile对应的resource文件总是不正确的. 即便是加了 mvn clean package -P ...

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

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

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

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

  8. CAS (13) —— CAS 使用Maven Profile支持多环境编译

    CAS (13) -- CAS 使用Maven Profile支持多环境编译 摘要 CAS 使用Maven Profile支持多环境编译 版本 tomcat版本: tomcat-8.0.29 jdk版 ...

  9. maven profile 优先级

    maven profile是有优先级别 也就是说在setting.xml的profile优先级比pom中同名的profile高. 可以使用 mvn help:active-profiles 这个命令是 ...

  10. How to activate maven profile inside eclipse

    How to activate maven profile inside eclipse Normally maven is use for project dependency management ...

随机推荐

  1. 第一天 python环境变量安装(2.7)

    一.什么是python Python 是一个高层次的结合了解释性.编译性.互动性和面向对象的脚本语言. Python 的设计简单,易学,免费,开源,面向对象,可拓展性 Python 是一种解释型语言: ...

  2. Centos7提示Initial setup of CentOS Linux 7 (core)

    Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License information (no user will be ...

  3. 淘宝sign算法和使用教程

    前言 最新写的淘宝热卖插件系列里面有涉及到淘宝sign算法加密,这里博主分享一下之前找到算法和修改后的算法以及使用教程.在此希望能帮助更多的人,欢迎各位加入我的交流Q群:468458543,群内不定时 ...

  4. centos7.8GPU服务器搭建

    首先官方文档有cuda驱动和toolkit和Linux内核本,gcc版本的对应关系,其中也有一些安装过程可参考: https://developer.nvidia.com/cuda-toolkit-a ...

  5. H5移动端跳转唤起QQ在线客服与跳转支付宝

    以下两段代码都是找了很久的,在某个删库跑路的支付商那里找到的! H5移动端跳转QQ 实现在线客服 <a href="mqqwpa://im/chat?chat_type=wpa& ...

  6. Unity 保存截图功能

    1.下面是实现代码 using System.Collections; using System.Collections.Generic; using UnityEditor; using Unity ...

  7. supervisor(进程管理)

    1.安装程序 yum -y install supervisor 2.路径文件 /etc/supervisord.d /etc/supervisord.conf 3.生成配置. echo_superv ...

  8. 【Java】BigDecimal

    BigDecimal转int类型 BigDecimal a=new BigDecimal(12.88); int b=a.intValue(); System.out.println(b);//b=1 ...

  9. uni-app 通过后缀名区分不同渠道版本

    同一套微信小程序代码根据需求要打包成两款小程序,主要逻辑页面一致,主题色不一致,部分页面布局不,逻辑不一致. script命令 先在package.json的script新增命令,根据不同的命令生成对 ...

  10. vue创建模板

    文件-->首选项-->用户代码片段-->点击新建代码片段--取名vue.json 确定 { "生成vue 模板": { "prefix": & ...