Parent Pom中html
<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中web
<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>
[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爲很是量值的狀況,咱們就須要第三方插件來幫咱們自動完成升級版本的工做。express
參見下文:apache
http://mojo.codehaus.org/versions-maven-plugin/examples/update-child-modules.htmlmaven
這個插件等於只須要咱們在parent pom中變動一下版本號,而後執行ide
mvn -N versions:update-child-modules這個命令,就會將全部依賴的地方所有變成新的版本號,從而幫咱們完成該問題。ui