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. NAT模式下Debian无法上网和VIM无法删除字符的处理方法

    NAT模式下Debian无法上网的处理方法 处理方法共分为二种 检测 VM 的 NAT 服务有无开启 查看虚拟机的网络信息设置是否正确 检测 VM 的 NAT 服务有无开启 win+R 输入 serv ...

  2. 【Direct3D 12】什么是Direct3D 12

    什么是DirectX? Microsoft DirectX是一套图形API,可以用来创建游戏和高性能的图形应用.DirectX支持2D和3D图形. 什么是Direct3D 12? Direct3D是D ...

  3. Neo4j安装及简单使用【转】

    转载防丢失. 一.Neo4j和图数据库简介 neo4j是基于Java语言编写图形数据库.图是一组节点和连接这些节点的关系.图形数据库也被称为图形数据库管理系统或GDBMS. Neo4j的是一种流行的图 ...

  4. 【个人笔记】CentOS 安装 Docker CE

    要在 CentOS 上开始使用 Docker CE,请确保 满足先决条件,然后 安装Docker. 1. 卸载旧版本 sudo yum remove docker docker-client dock ...

  5. Python爬取三国演义章节标题和内容(bs4爬取,解决中文乱码)

    import os.path import requests from bs4 import BeautifulSoup if __name__ == '__main__': if not os.pa ...

  6. shell语法4-printf命令、test命令和判断符号[]、逻辑运算符&&和||

    一.printf命令 printf命令用于格式化输出,类似于C/C++中的printf函数. 默认不会在字符串末尾添加换行符!!! 例如: printf "%10d.\n" 123 ...

  7. 12组-Alpha冲刺-6/6

    12组-Alpha冲刺-6/6 一.基本情况 队名:字节不跳动 组长博客:https://www.cnblogs.com/147258369k/p/15573118.html 小组人数:10人 二.冲 ...

  8. 使用vue渲染大量数据时应该怎么优化?

    Object.freeze 适合一些 big data的业务场景.尤其是做管理后台的时候,经常会有一些超大数据量的 table,或者一个含有 n 多数据的图表,这种数据量很大的东西使用起来最明显的感受 ...

  9. pands 编码知识

    一,pandas功能 1,基于numpy , 分析结构化数据. 二,常用基础知识编码练习 包括数据类型,数据操作,比如索引,分片 ,分组聚合 ,排序 过滤等等数分常见操作代码 # coding=utf ...

  10. zabbix连接Mysql提示Can’t connect to local MySQL server through socket的解决方法

    要解决此错误,有两种解决方法: 1.将连接参数"host"的值由"localhost"改成"127.0.0.1": 2.按下面方法,在&qu ...