Skip to content

[MNG-6727] Using version range in parent and CI Friendly Version fails #8308

Closed

Description

@jira-importer

Tom Kiemes opened MNG-6727 and commented

We would like to pass a version range to the parent which should be possible since 3.5.0

At the same time, we would like to use CI friendly versions for the artifact itself.

Both on their own work well, but combined they don't.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ``xsi:schemaLocation="[http://maven.apache.org/POM/4.0.0] [http://maven.apache.org/xsd/maven-4.0.0.xsd]">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>[2.1,3.0)</version>
  </parent>

  <groupId>com.example</groupId>
  <artifactId>test</artifactId>
  <version>${revision}</version>
  <packaging>pom</packaging>

  <properties>
    <revision>0.0.1</revision>
  </properties>
</project>

 

The resulting error is:

The project com.example:test:${revision} (/Users/d045390/scratch/test.pom) has 1 error
[ERROR] Version must be a constant @ line 13, column 12

 

Changing the version range of the parent to a fixed version e.g. 2.1.5.Release, building works.

Changing the artifact version from ${revision} to a fixed version e.g. 0.0.1 without using the properties works as well.

So it somehow must be the combination of both features which are actually not really related or am I missing something?

PS: I left the modules out for abbreviation purpose. The pom itself can still be used to reproduced


Affects: 3.5.2, 3.6.1, 3.6.2, 3.6.3

Remote Links:

Backported to: 4.0.0-alpha-2, 3.8.5

4 votes, 10 watchers

Activity

  1. jira-importer commented on Aug 20, 2019

    @jira-importer
    Author

    Vasiliy commented

    I ran into same issue. Any solutions?

    We have a multirepo, multi module project. All repos derive from a single pom repo called "top" and versions are all over the pom files. I am trying to avoid static versions in pom files and use $revision. However, if I use $revision inside the parent section of a deriving repo's pom.xml (this not a multimodule repo), mvn is trying to resolve top-${revision} (literally) instead of top-1.0.0 (i used mvn -Drevision=1.0.0 clean install).

    Since that didnt work, I tried to fix the top's version as a fixed range and ran into above issue, where $revision and range does not work together.

    Either way I am unable to avoid putting static version numbers in all our pom files.

    Any help appreciated.

  2. jira-importer commented on Nov 27, 2019

    @jira-importer
    Author

    Karl Heinz Marbaise commented

    Based on MNG-2199 this has been fixed with Maven 3.5.0-alpha,3.5.0. The error message looks like using an older version of Maven not one which able to handle revision property for version tags?.

  3. jira-importer commented on Nov 28, 2019

    @jira-importer
    Author

    Thorsten Meinl commented

    I can confirm that this is still an issue with 3.6.x.

  4. jira-importer commented on Nov 30, 2019

    @jira-importer
    Author

    Karl Heinz Marbaise commented

    Unfortunately I have to confirm that as well.

  5. jira-importer commented on Oct 22, 2020

    @jira-importer
    Author

    Ralf commented

    Yes. "Unfortunately I have to confirm that as well."
    Too much time spend finding out what the issue actually is. Searching the problem in my poms. Both features work fine for themselves. The parent version range and cli friendly versions - but once you combine them - your screwed. I have no real solution :( 
    The only work around I found in a multi module project - when I'm not interested in the parent-artifacts anyways - that I set the parent version to a fixed SNAPSHOT like "dev-SNAPSHOT" and only apply the correct ${revision} to the child modules. Not very elegant and not a solution for single module projects...

  6. jira-importer commented on Dec 29, 2020

    @jira-importer
    Author

    Jeff Maxwell commented

    I believe the root causes is this section

    The code attempts to prevent parent version ranges being used as the child version, which is a good thing, but the solution, checking if the child version starts with ${ breaks the combined usage of parent version ranges and property based versions.

    Can this check just be replaced with a check if the version is set via either ${project.version} or ${project.parent.version}?

    Or can the contents of the childModel.getVersion() be evaluated at this point and checked if the value is truly a version range?

  7. jira-importer commented on Dec 29, 2020

    @jira-importer
    Author

    Michael Osipov commented

    Is the issue still observed with Maven from master?

  8. jira-importer commented on Dec 30, 2020

    @jira-importer
    Author

    Jeff Maxwell commented

    I believe I have this resolved in the PR.  Can this be back ported to 3.6.x?

  9. jira-importer commented on Jan 6, 2021

    @jira-importer
    Author

    Jeff Maxwell commented

    Resubmitted the PR, hopefully it will pass all jdk ITs.

    I have added additional test coverage.

  10. jira-importer commented on Jan 6, 2022

    @jira-importer
    Author

    Michael Osipov commented

    Jeff Maxwell, one year has passed, today is my birthday again and make me a present: Take a look at my comments on the PR and I will review and merge.

  11. jira-importer commented on Feb 1, 2022

    @jira-importer
    Author
  12. added
    bug
    priority:major
    on Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority:major

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions