There're project A and many other projects A1, A2 ... A10. A is the parent of all other A[n] projects.. I used a property <project.version> in all the pom files so when I need to change the version number, I only need to change it in A's pom.xml. Actually it works well.
pom.xml of A <artifactId>A</artifactId> <version>${project.version}</version> <packaging>pom</packaging> <modules> <module>A1</module> <module>A2</module> <module>A3</module> </modules> <properties> <project.version>2.0</project.version> </properties> pom.xml of A1: <parent> <artifactId>A1</artifactId> <relativePath>../pom.xml</relativePath> <version>${project.version}</version> </parent> I have another project B, which depends on A1. <dependency> <artifactId>A1</artifactId> <version>2.0</version> </dependency> To build B: 1) in directory of A, run mvn clean install, it succeeds, and all jars are installed to local repository. 2) in directory of B, run mvn clean package. it fails with messages: [INFO] ------------------------------------------------------------------------ [INFO] Building B [INFO] ------------------------------------------------------------------------ Downloading: http://repo1.maven.org/maven2/com/.../.../.../${project.version}/A-${project.version}.pom [INFO] ------------------------------------------------------------------------ Actually jar file of A1 is already ready at local repository at xxx/2.0/ Why maven just pickup the jar file and compile? It seems trying to parse the A1's pom.xml and doesn't understand project.version. Anyone got any ideas? I'm stuck at this for weeks. For some reasons I cannot change the pom files of A, A1. How to write B's project to build successfully?