【发布时间】:2012-01-11 23:33:16
【问题描述】:
我有这个目录结构
root
|- pom.xml
|- submodule1
|- pom.xml
|- project.properties
|- subsubmodules
|-pom.xml
Submodule1 继承自 root,subsubmodules 继承自 submodule1
Subsubmodules 具有使用 submodule1 的 project.properties 中的属性来定义其版本的依赖项。 即在子子模块中
<dependency>
<groupId>some.org</groupId>
<artifactId>someartifact</artifactId>
<version>${themodules.version}</version>
</dependency>
在 Submodule1 的 project.properties 中,我有
themodules.version = 1.0
所以我通过在根 pom.xml 中定义来使用 properties-maven-plugin
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<!-- *edited from earlier post <file>etc/config/dev.properties</file>-->
<file>${basedir}/project.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
然后我在根级别运行 mvn install。 Maven 说它无法解析依赖项中的 ${themodules.version}。
我还在子模块级别运行了 mvn install ,但仍然无法解决。
请帮忙
【问题讨论】:
标签: maven-plugin