我有一個包含多個模塊的maven項目。在Eclipse中(Juno,使用m2e)它似乎編譯得很好。但是當我在其中一個模塊上進行maven安裝時,構建立即失敗。'dependencies.dependency.version'缺少錯誤,但版本是在父項中管理的
父POM:
<groupId>com.sw.system4</groupId>
<artifactId>system4-parent</artifactId>
<version>${system4.version}</version>
<packaging>pom</packaging>
<name>System 4 Parent Project</name>
<modules>
<module>system4-data</module>
...others...
</modules>
<properties>
<system4.version>0.0.1-SNAPSHOT</system4.version>
<spring.version>3.2.3.RELEASE</spring.version>
... others...
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>runtime</scope>
</dependency>
... lots of others ...
</dependencies>
</dependencyManagement>
兒童POM:
<parent>
<groupId>com.sw.system4</groupId>
<artifactId>system4-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>system4-data</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<scope>runtime</scope>
</dependency>
... lots of others...
</dependencies>
當我建,我得到下面的輸出:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.sw.system4:system4-data:0.0.1-SNAPSHOT (C:\work\eclips
e_workspaces\systemiv\system4-parent\system4-data\pom.xml) has 8 errors
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-cor
e:jar is missing. @ line 16, column 16
... others omitted for clarity ...
我不明白爲什麼它甚至不試圖編譯。我試圖從父母和孩子中刪除運行時範圍,並沒有區別。請幫忙!
[dependencies.dependency.version可能重複,即使依賴已在它的父級的pom文件的依賴項管理部分中聲明]丟失(http://stackoverflow.com/questions/12900525/dependencies-dependency-version-is -missing-even-the-depen-the-dependency-is-already) – JohnEye