Mojo's Versions Maven Plugin
  1. Mojo's Versions Maven Plugin
  2. MVERSIONS-123

Version properties inparent not picked up by e.g. display-property-updates

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows XP
      Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
    • Number of attachments :
      1

      Description

      The goals operating on property controlled version numbers (e.g. display-property-updates) only work if the properties are defined in the targeted POM itself, not in a parent POM.

      Example:

      If module B has a dependency on module A, declared in B as follows:

      <dependency>
      <groupId>com.my.test</groupId>
      <artifactId>module-A</artifactId>
      <version>$

      {module-A.version}</version>
      </dependency>

      but ${module-A.version}

      is not defined in B's own POM, but its parent, then the plugin doesn't pick it up - it simply says:

      "This project does not have any properties associated with versions"

      This is a major problem for us, since all our dependency version properties are defined in each project's root POM, i.e. the parent of all sub-modules in that project.

        Activity

        Hide
        Stephen Connolly added a comment -

        This is by design.

        If the property is not defined in the current pom, then there are no properties to update in the current pom.

        If the properties are defined in the parent pom, then run the goal from the parent pom (including the child projects as part of the aggregator if necessary in order to pick up the dependencies)

        Show
        Stephen Connolly added a comment - This is by design. If the property is not defined in the current pom, then there are no properties to update in the current pom. If the properties are defined in the parent pom, then run the goal from the parent pom (including the child projects as part of the aggregator if necessary in order to pick up the dependencies)
        Hide
        Cornel Masson added a comment -

        Don't know if I'm missing something, but I've tried that as well.

        • define property $ {module-A.version} in parent of B
          - define B as child module of parent (modules section)
          - declare A as dependency in B's POM, but with version ${module-A.version}

          (should pick up from parent)

        • run: mvn versions:display-property-updates -DallowSnapshots on parent-of-B
        • this builds parent-of-B as well as the child module, B
        • but still get:

        "This project does not have any properties associated with versions"

        And there is definitely a new version available, because it works if I move the property $

        {module-A.version} to B itself:

        [INFO] The following version property updates are available:
        [INFO] ${module-A.version}

        ........... 1.0.0 -> 1.0.1-SNAPSHOT

        Show
        Cornel Masson added a comment - Don't know if I'm missing something, but I've tried that as well. define property $ {module-A.version} in parent of B - define B as child module of parent (modules section) - declare A as dependency in B's POM, but with version ${module-A.version} (should pick up from parent) run: mvn versions:display-property-updates -DallowSnapshots on parent-of-B this builds parent-of-B as well as the child module, B but still get: "This project does not have any properties associated with versions" And there is definitely a new version available, because it works if I move the property $ {module-A.version} to B itself: [INFO] The following version property updates are available: [INFO] ${module-A.version} ........... 1.0.0 -> 1.0.1-SNAPSHOT
        Hide
        Cornel Masson added a comment -

        The attached example demonstrates the problem. Run:

        $ cd versiontest
        $ mvn versions:display-property-updates
        

        and you'll get: "This project does not have any properties associated with versions"

        But then move the <junit.version> property from the parent down to moduleA, and it works:

        The following version property updates are available:
        ${junit.version} ......................... 3.8.1 -> 4.8.1
        
        Show
        Cornel Masson added a comment - The attached example demonstrates the problem. Run: $ cd versiontest $ mvn versions:display-property-updates and you'll get: "This project does not have any properties associated with versions" But then move the <junit.version> property from the parent down to moduleA , and it works: The following version property updates are available: ${junit.version} ......................... 3.8.1 -> 4.8.1
        Show
        Cornel Masson added a comment - See attached example, as well as http://stackoverflow.com/questions/3628471/maven-versions-plugin-not-picking-up-properties-from-parent
        Hide
        Stephen Connolly added a comment -

        if there is no property defined in B then there are no updates that can be made in B so when you run the goal within the scope of the B project only, then there is nothing to do.

        A separate issue is that when you run the goal from a reactor that has both B and A that the goal does not pick up B's usage of the property defined in A... but AFAIK that issue is already filed.

        The issue you describe is not a bug but functioning as designed.

        Show
        Stephen Connolly added a comment - if there is no property defined in B then there are no updates that can be made in B so when you run the goal within the scope of the B project only, then there is nothing to do. A separate issue is that when you run the goal from a reactor that has both B and A that the goal does not pick up B's usage of the property defined in A... but AFAIK that issue is already filed. The issue you describe is not a bug but functioning as designed.
        Hide
        Gagandeep added a comment -

        Given that this plugin doesn't support what Cornel Masson wants, can you suggest some code to find the dependency in a submodule when the corresponding version property is defined in the parent pom? The "wnr" and "as" object under returns nothing when the property is defined in the parent pom. Any way around to actually update the property even if it's defined in parent?

        ArtifactVersion wnr = version.getNewestVersion( currentVersion, property, this.allowSnapshots, this.reactorProjects, this.getHelper() );
        ArtifactAssociation[] as = version.getAssociations();

        Show
        Gagandeep added a comment - Given that this plugin doesn't support what Cornel Masson wants, can you suggest some code to find the dependency in a submodule when the corresponding version property is defined in the parent pom? The "wnr" and "as" object under returns nothing when the property is defined in the parent pom. Any way around to actually update the property even if it's defined in parent? ArtifactVersion wnr = version.getNewestVersion( currentVersion, property, this.allowSnapshots, this.reactorProjects, this.getHelper() ); ArtifactAssociation[] as = version.getAssociations();

          People

          • Assignee:
            Unassigned
            Reporter:
            Cornel Masson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: