Hello fellow Maven users,

At $work a problem occurs with evaluation the ${project.parent.version} from a 
child pom.

The product structure in question:

Product A:
/pom.xml <= productA-parent (version 10.2.4-SNAPSHOT)

/submodule1/pom.xml <= productA-sub1
=> submodule1 uses productA-parent as parent
=> submodule1 contains submodule2 in its modules section => 
<module>../submodule2</module>

/submodule2/pom.xml <= productA-sub2
=> submodule2 uses submodule1 as parent with relativePath ../submodule1/

Submodule2 has a dependency which is activated in a profile which refers to 
submodule1:
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.work.productA</groupId>
      <artifactId>productA-submodule1</artifactId>
      <version>${project.parent.version}</version>     <= this property is 
incorrectly evaluated
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependency>
  <groupId>com.example.productA</groupId>
  <artifactId>productA-submodule1</artifactId>
  <version>${project.parent.version}</version>     <= this property is 
incorrectly evaluated
  <type>pom</type>
</dependency>

Product B:
/pom.xml <= productB-parent (version 0.0.6-SNAPSHOT)
=> this uses the productA-sub2 as its parent

/submodule1/pom.xml <= productB-sub1
=> this uses the productB-parent as its parent.

The problem I am facing is that I expect that productB-sub1 is able to use 
productA-sub2 as
parent. Because productA-sub2 contains a dependency to productA-sub1 I expect 
that dependency
will be evaluated correctly. However, it is not and the 
${project.parent.version} in productA-sub2
is evaluated to the version of productB-parent.

The extensive error message:
================================
[ERROR] Non-resolvable import POM: Failure to find 
com.work.productA-sub1:pom:0.0.6-SNAPSHOT in <company repo> was cached in the 
local repository, resolution will not be reattempted until the update interval 
of <company repo> has elapsed or updates are forced @ 
productA-sub2:[unknown-version], 
/home/user/.m2/repository/com/work/productA-sub2/10.2.4-SNAPSHOT/productA-sub2-10.2.4-SNAPSHOT.pom,
 line 231, column 19 -> [Help 2]
================================

It seems that project.parent.version is evaluated to the version of 
productB-parent
(0.0.6-SNAPSHOT) instead of the version of productA-parent (10.2.4-SNAPSHOT).

How can I ensure that the project.parent.version property resolves to the 
correct value (productA
version => 10.2.4-SNAPSHOT) instead of the productB-parent version 
(0.0.6-SNAPSHOT) ?

Hope someone can help me out.

Best regards,
Roy


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to