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>

最新文章

  1. js get browser vertion (js获取浏览器信息版本)
  2. 洛谷P3388 【模板】割点
  3. Why does this json4s code work in the scala repl but fail to compile?
  4. AxureRP8实战手册(基础1-10)
  5. A+Bproblem
  6. java 导入包(误区)
  7. angular-xeditable
  8. Mysql中将查询出来的多列的值用逗号拼接
  9. MVC项目总结(别人的好文章)
  10. Java 国际化 语言切换
  11. 【集训笔记】归纳与递推【HDOJ1297
  12. EasyUI - ComboBox 下拉组件
  13. 基于TI CC2650的IPv6 over BLE(BLEach) demo
  14. mysql存储过程游标使用
  15. 启动tomcat时报错:http-nio-8080-exec-10
  16. (29)Why Earth may someday look like Mars
  17. Android性能优化9-ANR完全解析
  18. 环境准备——之Jdk安装
  19. angular.copy(source, destination)
  20. JavaScript数据类型(第一天)

热门文章

  1. sql server 主键自增
  2. git账号密码修改
  3. 使用windows平板学习与办公的一些经历(酷比魔方i9篇)
  4. Linux 部署apache2.4
  5. 【Python】【算法】【排序】用Python实现排序的三种算法
  6. MySQL 增加timestamp 列都是000000的时间
  7. echarts饼图同时展示数量和百分比
  8. 关于head中代码被挤到body中的问题
  9. 慢sql_查询条件加了函数导致索引失效
  10. 066_VFPage中Js Button与controller交互方式(一)