You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Roy Lenferink <rl...@apache.org> on 2020/10/23 10:11:19 UTC

Incorrect evaluated project.parent.version in child pom

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Incorrect evaluated project.parent.version in child pom

Posted by Roy Lenferink <rl...@apache.org>.
Hi Alexander,

Thanks for your reply. Sometimes the easiest solutions are something one can forget.
I'll try to setup a sample project.

Roy

On 2020/10/25 02:39:12, "Alexander Kriegisch" <al...@kriegisch.name> wrote: 
> Hello Roy.
> 
> Your textual description is nice and contains a lot of information, but
> why not attach or link to a simple but complete reproducer project? The
> reason I am asking is that in order to reproduce this, every reader
> needs to carefully try to recreate your situation manually. Errors in
> doing so are likely, especially given the following facts:
> 
>   -- Your directory layout is rather unconventional.
>   -- Your sample artifact naming is cryptic.
>   -- You submodule artifact names differ from directory names.
>   -- You seem to have an artifact named productA-sub1, but also one
>      named productA-submodule1. Are they the same or different? If they
>      are the same, why would you define a dependency on the parent
>      module which probably has POM packaging?
> 
> Let the POMs speak for themselves, please. Thank you.
> 
> Cheers
> -- 
> Alexander Kriegisch
> https://scrum-master.de
> 
> 
> Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):
> 
> > 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-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Incorrect evaluated project.parent.version in child pom

Posted by Alexander Kriegisch <al...@kriegisch.name>.
At least Maven Dependency Plugin seems to cause some problems, I noticed
after writing you when calling

  mvn dependency:tree
  mvn dependency:analyze

with or without previous clean or compile.

I got to admit that your project structure looks somewhat strange, but
still there seems to be something not okay with the version number
resolution, like you said. I am by no means an expert in the depths of
Maven. I wish one of the developers would take a look and make a more
authoritative statement.

-- 
Alexander Kriegisch
https://scrum-master.de


Roy Lenferink schrieb am 28.10.2020 16:19 (GMT +07:00):

> Hi Alexander,
> 
> Thanks for thinking with me!
> 
> I forgot to mention that I _do_ make use of the maven-dependency-plugin with
> the 
> copy-dependencies goal to copy my dependencies to the target/dependencies/
> folder. This is being
> executed in the clean phase [1]. If I move it to e.g. the compile phase then
> the compile phase starts
> failing. Could it be the maven-dependency-plugin being the one throwing the
> error?
> 
> Regards,
> Roy
> 
> [1] https://s.apache.org/rlenferink-mvn-1
> 
> On 2020/10/28 01:22:39, "Alexander Kriegisch" <al...@kriegisch.name> wrote:
> 
>> Thanks Roy,
>> 
>> I noticed that the actual build lifecycle (goals like validate, compile,
>> install) works as expected. The problem seems to be in the clean lifecycle,
>> i.e. possibly somewhere in the Maven Clean Plugin. No matter if I use the
>> default plugin version 3.5 or upgrade to 3.1.0, the problem occurs when
>> calling 'mvn clean' in directory 'productB'. Maybe you should raise an issue.
>> -- 
>> Alexander Kriegisch
>> https://scrum-master.de
>> 
>> 
>> Roy Lenferink schrieb am 28.10.2020 02:18 (GMT +07:00):
>> 
>> > Hi Alexander,
>> > 
>> > I just created a test project sketching the scenario I am having. See the
>> > following repo:
>> > https://github.com/rlenferink/maven-properties-project
>> > 
>> > I put the instructions for testing in the README. 
>> > 
>> > In my text example there where indeed some mismatches, I hope the repo with
>> > sample data
>> > resolves those unclarities.
>> > 
>> > Hope someone can clarify whether this is expected Maven behavior or not.
>> > 
>> > Best regards,
>> > Roy
>> > 
>> > On 2020/10/25 02:39:12, "Alexander Kriegisch" <al...@kriegisch.name>
>> wrote:
>> > 
>> >> Hello Roy.
>> >> 
>> >> Your textual description is nice and contains a lot of information, but
>> >> why not attach or link to a simple but complete reproducer project? The
>> >> reason I am asking is that in order to reproduce this, every reader
>> >> needs to carefully try to recreate your situation manually. Errors in
>> >> doing so are likely, especially given the following facts:
>> >> 
>> >>   -- Your directory layout is rather unconventional.
>> >>   -- Your sample artifact naming is cryptic.
>> >>   -- You submodule artifact names differ from directory names.
>> >>   -- You seem to have an artifact named productA-sub1, but also one
>> >>      named productA-submodule1. Are they the same or different? If they
>> >>      are the same, why would you define a dependency on the parent
>> >>      module which probably has POM packaging?
>> >> 
>> >> Let the POMs speak for themselves, please. Thank you.
>> >> 
>> >> Cheers
>> >> -- 
>> >> Alexander Kriegisch
>> >> https://scrum-master.de
>> >> 
>> >> 
>> >> Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):
>> >> 
>> >> > 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-unsubscribe@maven.apache.org
>> >> > For additional commands, e-mail: users-help@maven.apache.org
>> >> > 
>> >> > 
>> >> 
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >> 
>> >> 
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> > 
>> > 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Incorrect evaluated project.parent.version in child pom

Posted by Roy Lenferink <rl...@apache.org>.
Hi Alexander,

Thanks for thinking with me!

I forgot to mention that I _do_ make use of the maven-dependency-plugin with the 
copy-dependencies goal to copy my dependencies to the target/dependencies/ folder. This is being
executed in the clean phase [1]. If I move it to e.g. the compile phase then the compile phase starts
failing. Could it be the maven-dependency-plugin being the one throwing the error?

Regards,
Roy

[1] https://s.apache.org/rlenferink-mvn-1

On 2020/10/28 01:22:39, "Alexander Kriegisch" <al...@kriegisch.name> wrote: 
> Thanks Roy,
> 
> I noticed that the actual build lifecycle (goals like validate, compile, install) works as expected. The problem seems to be in the clean lifecycle, i.e. possibly somewhere in the Maven Clean Plugin. No matter if I use the default plugin version 3.5 or upgrade to 3.1.0, the problem occurs when calling 'mvn clean' in directory 'productB'. Maybe you should raise an issue.
> -- 
> Alexander Kriegisch
> https://scrum-master.de
> 
> 
> Roy Lenferink schrieb am 28.10.2020 02:18 (GMT +07:00):
> 
> > Hi Alexander,
> > 
> > I just created a test project sketching the scenario I am having. See the
> > following repo:
> > https://github.com/rlenferink/maven-properties-project
> > 
> > I put the instructions for testing in the README. 
> > 
> > In my text example there where indeed some mismatches, I hope the repo with
> > sample data
> > resolves those unclarities.
> > 
> > Hope someone can clarify whether this is expected Maven behavior or not.
> > 
> > Best regards,
> > Roy
> > 
> > On 2020/10/25 02:39:12, "Alexander Kriegisch" <al...@kriegisch.name> wrote:
> > 
> >> Hello Roy.
> >> 
> >> Your textual description is nice and contains a lot of information, but
> >> why not attach or link to a simple but complete reproducer project? The
> >> reason I am asking is that in order to reproduce this, every reader
> >> needs to carefully try to recreate your situation manually. Errors in
> >> doing so are likely, especially given the following facts:
> >> 
> >>   -- Your directory layout is rather unconventional.
> >>   -- Your sample artifact naming is cryptic.
> >>   -- You submodule artifact names differ from directory names.
> >>   -- You seem to have an artifact named productA-sub1, but also one
> >>      named productA-submodule1. Are they the same or different? If they
> >>      are the same, why would you define a dependency on the parent
> >>      module which probably has POM packaging?
> >> 
> >> Let the POMs speak for themselves, please. Thank you.
> >> 
> >> Cheers
> >> -- 
> >> Alexander Kriegisch
> >> https://scrum-master.de
> >> 
> >> 
> >> Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):
> >> 
> >> > 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-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> >> > 
> >> > 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >> 
> >> 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Incorrect evaluated project.parent.version in child pom

Posted by Alexander Kriegisch <al...@kriegisch.name>.
Typo! I mean "default plugin version 2.5".

Alexander Kriegisch schrieb am 28.10.2020 08:22 (GMT +07:00):

> Thanks Roy,
> 
> I noticed that the actual build lifecycle (goals like validate, compile,
> install) works as expected. The problem seems to be in the clean lifecycle,
> i.e. possibly somewhere in the Maven Clean Plugin. No matter if I use the
> default plugin version 3.5 or upgrade to 3.1.0, the problem occurs when calling
> 'mvn clean' in directory 'productB'. Maybe you should raise an issue.
> -- 
> Alexander Kriegisch
> https://scrum-master.de
> 
> 
> Roy Lenferink schrieb am 28.10.2020 02:18 (GMT +07:00):
> 
>> Hi Alexander,
>> 
>> I just created a test project sketching the scenario I am having. See the
>> following repo:
>> https://github.com/rlenferink/maven-properties-project
>> 
>> I put the instructions for testing in the README. 
>> 
>> In my text example there where indeed some mismatches, I hope the repo with
>> sample data
>> resolves those unclarities.
>> 
>> Hope someone can clarify whether this is expected Maven behavior or not.
>> 
>> Best regards,
>> Roy
>> 
>> On 2020/10/25 02:39:12, "Alexander Kriegisch" <al...@kriegisch.name>
>> wrote:
>> 
>>> Hello Roy.
>>> 
>>> Your textual description is nice and contains a lot of information, but
>>> why not attach or link to a simple but complete reproducer project? The
>>> reason I am asking is that in order to reproduce this, every reader
>>> needs to carefully try to recreate your situation manually. Errors in
>>> doing so are likely, especially given the following facts:
>>> 
>>>   -- Your directory layout is rather unconventional.
>>>   -- Your sample artifact naming is cryptic.
>>>   -- You submodule artifact names differ from directory names.
>>>   -- You seem to have an artifact named productA-sub1, but also one
>>>      named productA-submodule1. Are they the same or different? If they
>>>      are the same, why would you define a dependency on the parent
>>>      module which probably has POM packaging?
>>> 
>>> Let the POMs speak for themselves, please. Thank you.
>>> 
>>> Cheers
>>> -- 
>>> Alexander Kriegisch
>>> https://scrum-master.de
>>> 
>>> 
>>> Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):
>>> 
>>> > 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-unsubscribe@maven.apache.org
>>> > For additional commands, e-mail: users-help@maven.apache.org
>>> > 
>>> > 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Incorrect evaluated project.parent.version in child pom

Posted by Alexander Kriegisch <al...@kriegisch.name>.
Thanks Roy,

I noticed that the actual build lifecycle (goals like validate, compile, install) works as expected. The problem seems to be in the clean lifecycle, i.e. possibly somewhere in the Maven Clean Plugin. No matter if I use the default plugin version 3.5 or upgrade to 3.1.0, the problem occurs when calling 'mvn clean' in directory 'productB'. Maybe you should raise an issue.
-- 
Alexander Kriegisch
https://scrum-master.de


Roy Lenferink schrieb am 28.10.2020 02:18 (GMT +07:00):

> Hi Alexander,
> 
> I just created a test project sketching the scenario I am having. See the
> following repo:
> https://github.com/rlenferink/maven-properties-project
> 
> I put the instructions for testing in the README. 
> 
> In my text example there where indeed some mismatches, I hope the repo with
> sample data
> resolves those unclarities.
> 
> Hope someone can clarify whether this is expected Maven behavior or not.
> 
> Best regards,
> Roy
> 
> On 2020/10/25 02:39:12, "Alexander Kriegisch" <al...@kriegisch.name> wrote:
> 
>> Hello Roy.
>> 
>> Your textual description is nice and contains a lot of information, but
>> why not attach or link to a simple but complete reproducer project? The
>> reason I am asking is that in order to reproduce this, every reader
>> needs to carefully try to recreate your situation manually. Errors in
>> doing so are likely, especially given the following facts:
>> 
>>   -- Your directory layout is rather unconventional.
>>   -- Your sample artifact naming is cryptic.
>>   -- You submodule artifact names differ from directory names.
>>   -- You seem to have an artifact named productA-sub1, but also one
>>      named productA-submodule1. Are they the same or different? If they
>>      are the same, why would you define a dependency on the parent
>>      module which probably has POM packaging?
>> 
>> Let the POMs speak for themselves, please. Thank you.
>> 
>> Cheers
>> -- 
>> Alexander Kriegisch
>> https://scrum-master.de
>> 
>> 
>> Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):
>> 
>> > 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-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> > 
>> > 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Incorrect evaluated project.parent.version in child pom

Posted by Roy Lenferink <rl...@apache.org>.
Hi Alexander,

I just created a test project sketching the scenario I am having. See the following repo:
https://github.com/rlenferink/maven-properties-project

I put the instructions for testing in the README. 

In my text example there where indeed some mismatches, I hope the repo with sample data
resolves those unclarities.

Hope someone can clarify whether this is expected Maven behavior or not.

Best regards,
Roy

On 2020/10/25 02:39:12, "Alexander Kriegisch" <al...@kriegisch.name> wrote: 
> Hello Roy.
> 
> Your textual description is nice and contains a lot of information, but
> why not attach or link to a simple but complete reproducer project? The
> reason I am asking is that in order to reproduce this, every reader
> needs to carefully try to recreate your situation manually. Errors in
> doing so are likely, especially given the following facts:
> 
>   -- Your directory layout is rather unconventional.
>   -- Your sample artifact naming is cryptic.
>   -- You submodule artifact names differ from directory names.
>   -- You seem to have an artifact named productA-sub1, but also one
>      named productA-submodule1. Are they the same or different? If they
>      are the same, why would you define a dependency on the parent
>      module which probably has POM packaging?
> 
> Let the POMs speak for themselves, please. Thank you.
> 
> Cheers
> -- 
> Alexander Kriegisch
> https://scrum-master.de
> 
> 
> Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):
> 
> > 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-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Incorrect evaluated project.parent.version in child pom

Posted by Alexander Kriegisch <al...@kriegisch.name>.
Hello Roy.

Your textual description is nice and contains a lot of information, but
why not attach or link to a simple but complete reproducer project? The
reason I am asking is that in order to reproduce this, every reader
needs to carefully try to recreate your situation manually. Errors in
doing so are likely, especially given the following facts:

  -- Your directory layout is rather unconventional.
  -- Your sample artifact naming is cryptic.
  -- You submodule artifact names differ from directory names.
  -- You seem to have an artifact named productA-sub1, but also one
     named productA-submodule1. Are they the same or different? If they
     are the same, why would you define a dependency on the parent
     module which probably has POM packaging?

Let the POMs speak for themselves, please. Thank you.

Cheers
-- 
Alexander Kriegisch
https://scrum-master.de


Roy Lenferink schrieb am 23.10.2020 17:11 (GMT +07:00):

> 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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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