在Maven2时,为了保障版本一致,一般之前我们的做法时:

Parent Pom中

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cy.nad.cyg</groupId>
<artifactId>pay</artifactId>
<version>${myproject.version}</version>
<packaging>pom</packaging>
<name>pay-parent</name> <modules>
<module>pay-web</module>
<module>pay-manage</module>
<module>pay-dao</module>
</modules> <properties>
<myproject.version>3.0.2</myproject.version>

在子module中

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>pay</artifactId>
<groupId>cy.nad.cyg</groupId>
<version>${myproject.version}</version>
</parent>
<artifactId>pay-web</artifactId>
<packaging>war</packaging>
<name>pay-web</name>
<properties>
<sso-client.version>0.0.3</sso-client.version>
</properties>
<dependencies> <dependency>
<groupId>cy.nad.cyg</groupId>
<artifactId>pay-dao</artifactId>
<version>${project.version}</version>
</dependency>

但是升级到maven3之后,会出这个问题:

[WARNING] Some problems were encountered while building the effective model for cy.nad.cyg:pay-web:war:3.0.2
[WARNING] 'version' contains an expression but should be a constant. @ cy.nad.cyg:pay:${myproject.version}, D:\workspace\idea\pay\pom.xml, line 7, column 14

这是因为Maven3 不允许出现version为非常量值的情况,我们就需要第三方插件来帮我们自动完成升级版本的工作。

参见下文:

http://mojo.codehaus.org/versions-maven-plugin/examples/update-child-modules.html

这个插件等于只需要我们在parent pom中变更一下版本号,然后执行

mvn -N versions:update-child-modules这个命令,就会将所有依赖的地方全部变成新的版本号,从而帮我们完成该问题。

maven2 up to maven3的'version' contains an expression but should be a constant的更多相关文章

  1. Maven3 package时报 'version' contains an expression but should be a constant

    父pom文件: <modelVersion>4.0.0</modelVersion> <groupId>com.wey</groupId> <ar ...

  2. 'version' contains an expression but should be a constant

    [WARNING] Some problems were encountered while building the effective model for com.app:cache:jar:4. ...

  3. 'version' contains an expression but should be a constant. @ line 13, column 11问题的解决

    <modelVersion>4.0.0</modelVersion> <groupId>cy.nad.cyg</groupId> <artifac ...

  4. Maven进行install的时候报错,COMPILATION ERROR : Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project cmu: There are test failures.

    maven进行install的时候,test类里面报错: COMPILATION ERROR : [INFO] -------------------------------------------- ...

  5. [Maven]Apache Maven 入门篇

    作者:George Ma 上 写这个 maven 的入门篇是因为之前在一个开发者会的动手实验中发现挺多人对于 maven 不是那么了解,所以就有了这个想法.这个入门篇分上下两篇.本文着重动手,用 ma ...

  6. maven 入门

    Apache Maven 入门篇 ( 上 ) 作者:George Ma 写这个 maven 的入门篇是因为之前在一个开发者会的动手实验中发现挺多人对于 maven 不是那么了解,所以就有了这个想法.这 ...

  7. mac java 环境设置

    MAC下JDK1.6下载路径 http://support.apple.com/kb/DL1572 Mac OS的java版本问题和Eclipse中无法找到jdk源代码的问题解决办法 下载包含源代码j ...

  8. Apache Maven入门篇(转)

    [上篇] 写这个 maven 的入门篇是因为之前在一个开发者会的动手实验中发现挺多人对于 maven 不是那么了解,所以就有了这个想法.这个入门篇分上下两篇.本文着重动手,用 maven 来构建运行 ...

  9. Apache Maven 入门篇

    2017-11-09注释:IntelliJ IDEA 2017.2.5 x64 等新版本会安装maven,为了有好的体验 建议在安装目录找到IntelliJ IDEA 2017.2.5\plugins ...

随机推荐

  1. hbase 过滤器属性及其兼容性

    内容来自于<HBASE权威指南>,留存备查,由于版本的原因,可能已经有变化,在应用前兼容性需要测试.

  2. 【转】查看 Linux 发行版名称和版本号的 8 种方法

    如果你加入了一家新公司,要为开发团队安装所需的软件并重启服务,这个时候首先要弄清楚它们运行在什么发行版以及哪个版本的系统上,你才能正确完成后续的工作.作为系统管理员,充分了解系统信息是首要的任务. 查 ...

  3. Redis学习 - 主从拷贝

    Redis主从拷贝的特点 同一个Master可以拥有多个Slaves. Master下的Slave还可以接受同一架构中其它slave的链接与同步请求,实现数据的级联复制,即Master->Sla ...

  4. 【codeforces 765F】 Souvenirs

    http://codeforces.com/problemset/problem/765/F (题目链接) 题意 给出$n$个数的序列,$m$次询问,每次查询区间$[l,r]$之间相差最小的两个数的差 ...

  5. 【bzoj3238】 Ahoi2013—差异

    http://www.lydsy.com/JudgeOnline/problem.php?id=3238 (题目链接) 题意 给出一个字符串,求${\sum_{1<=i<j<=n} ...

  6. VIM 模板

    Vim实现自动加载模版功能可以有很多的方法,比如利用插件和AutoCmd等.根据文件名自动加载模板的功能利用网上某大牛自己写的插件实现,我针对Java代码进行简单地修改,以实现模板中的Java主类类名 ...

  7. WEB入门.八 背景特效

    学习内容 background属性 CSS Sprite 技术 滑动门技术 能力目标 使用background设置网页背景 使用Sprites制作平滑投票特效 使用滑动门技术实现Tab菜单 本章简介 ...

  8. Qt error ------ incomplete type 'QApplication' used in nested name specifier

    没有包含 ‘QApplication’ 头文件

  9. Centos6.6下安装nginx1.6.3

    安装环境: [root@nginx ~]# cat /etc/redhat-release CentOS release 6.6 (Final) [root@nginx ~]# uname -r 2. ...

  10. 《剑指offer》面试题32----从1到n整数中1出现的次数

    题目:输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数.例如输入12,从1到12这些整数中包含1的数字有1,10,11和12,1一共出现了5次. 解法一:不考虑时间效率的解法(略) ps ...