我在Maven中設置了一個模塊化項目,其父項目具有多個子項目。Maven模塊 - 如何在無關項目中將其作爲外部庫使用
父的pom.xml
看起來如下 -
<project ...>
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>parent-app</artifactId>
<version>${parent-application.version}</version>
<packaging>pom</packaging>
<dependencies>...</dependencies>
<properties>
<parent-application.version>1.0</parent-application.version>
</properties>
<modules>
<module>parent-model</module>
<module>parent-masters</module>
<module>parent-web</module>
</modules>
</project>
的pom.xml
子項目看起來如下 -
<project ...>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company</groupId>
<artifactId>parent-app</artifactId>
<version>${parent-application.version}</version>
</parent>
<packaging>jar</packaging>
<artifactId>child-model</artifactId>
<dependencies>...</dependencies>
</project>
現在,我需要使用子項目之一作爲一個lib一個單獨的無關項目。新項目的pom如下所示。
<project ...>
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>unrelated-app</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>child-model</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
我不斷收到以下錯誤 Illegal character in path at index 57: http://repo.maven.apache.org/maven2/com/company/parent-app/${parent-application.version}/parent-app-${parent-application.version}.pom
原因似乎,我繼承了Prent公司應用內兒童模型版本屬性。
有沒有辦法解決這個問題?或者,我是否需要爲各個pom.xml中的每個子模塊提供版本,並且不能從公共父級繼承。
在此先感謝。