父pom文件:java
<modelVersion>4.0.0</modelVersion> <groupId>com.wey</groupId> <artifactId>WEY</artifactId> <version>${com.wey.version}</version> <packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion> <groupId>com.wey</groupId> <artifactId>WEY</artifactId> <version>${com.wey.version}</version> <packaging>pom</packaging>
package web工程時報 'version' contains an expression but should be a constant這個錯誤提示,這是由於Maven3 不容許出現version爲很是量值的狀況。web
那麼就將版本號改爲常量後能夠正常打包:express
父pom文件:apache
<modelVersion>4.0.0</modelVersion> <groupId>com.wey</groupId> <artifactId>WEY</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging>
子Moduleapp
<parent> <groupId>com.wey</groupId> <artifactId>WEY</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../WEY/pom.xml</relativePath> </parent> <artifactId>WEY.WebApp</artifactId> <packaging>war</packaging> <name>WEY.WebApp Maven Webapp</name> <url>http://maven.apache.org</url>
<modelVersion>4.0.0</modelVersion> <groupId>com.wey</groupId> <artifactId>WEY</artifactId> <version>0.0.2-SNAPSHOT</version> <packaging>pom</packaging> <parent> <groupId>com.wey</groupId> <artifactId>WEY</artifactId> <version>0.0.2-SNAPSHOT</version> <relativePath>../WEY/pom.xml</relativePath> </parent> <artifactId>WEY.WebApp</artifactId> <packaging>war</packaging> <name>WEY.WebApp Maven Webapp</name> <url>http://maven.apache.org</url>
Maven還會生成一個pom.xml.versionsBackup的備份文件。maven
提交更新:url
>mvn versions:commitxml