Maven Enforcer Plugin
  1. Maven Enforcer Plugin
  2. MENFORCER-42

Maven-Enforcer-Plugin fails in multimodule project when artifacts not in repository

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-alpha-3, 1.0
    • Fix Version/s: 1.3
    • Component/s: Plugin
    • Labels:
      None
    • Environment:
      Tested with Maven 2.0.7 and 2.0.8 on Linux with Java 1.5
    • Number of attachments :
      1

      Description

      Create a new simple multimodule-project and call mvn validate at the toplevel. This leads to a build failure if none of the multimodule-artifacts are in your local repository.

      Attached is a simple test project for reproducing this bug.

        Issue Links

          Activity

          Hide
          Michael Brackx added a comment -

          This is blocking as it prevents releasing (release:prepare).

          Show
          Michael Brackx added a comment - This is blocking as it prevents releasing (release:prepare).
          Hide
          Benjamin Bentmann added a comment -

          Seems to be related to the mail thread Enforcer Plugin and Dependency Resolution.

          Show
          Benjamin Bentmann added a comment - Seems to be related to the mail thread Enforcer Plugin and Dependency Resolution .
          Hide
          brianfox brianfox added a comment -

          are you using enforce-once? if so, this is deprecated in the next release as we can't make maven work correctly. In lieu of this, i added results caching to speed things up.

          Show
          brianfox brianfox added a comment - are you using enforce-once? if so, this is deprecated in the next release as we can't make maven work correctly. In lieu of this, i added results caching to speed things up.
          Hide
          Michael Brackx added a comment -

          I was indeed using enforce-once. Using enforce now. Thanks.

          Show
          Michael Brackx added a comment - I was indeed using enforce-once. Using enforce now. Thanks.
          Hide
          Jörg Hohwiller added a comment -

          I am having the same problem no matter if I use enforce-once or enforce. E.g. If I do "mvn eclipse:eclipse" the build fails if some reactor-dependency is NOT already installed in the local repository. When I remove the enforcer-plugin from my toplevel POM everything works well. This makes the enforcer-plugin useless since it causes more harm than it helps.

          Show
          Jörg Hohwiller added a comment - I am having the same problem no matter if I use enforce-once or enforce. E.g. If I do "mvn eclipse:eclipse" the build fails if some reactor-dependency is NOT already installed in the local repository. When I remove the enforcer-plugin from my toplevel POM everything works well. This makes the enforcer-plugin useless since it causes more harm than it helps.
          Hide
          Martin Höller added a comment -

          AFAIKT, this is not specific to the enforcer plugin.

          Show
          Martin Höller added a comment - AFAIKT, this is not specific to the enforcer plugin.
          Hide
          brianfox brianfox added a comment -

          The problem is that the eclipse plugin is running some lifecycle and thus kicking off the enforcer which requires maven to resolve dependencies that you may not have built yet. A workaround is to bind the enforcer to a phase like compile that is later than eclipse:eclipse kicks off.

          Show
          brianfox brianfox added a comment - The problem is that the eclipse plugin is running some lifecycle and thus kicking off the enforcer which requires maven to resolve dependencies that you may not have built yet. A workaround is to bind the enforcer to a phase like compile that is later than eclipse:eclipse kicks off.
          Hide
          Benjamin Bentmann added a comment -

          Future plugin versions should probably use the new anno @requiresDependencyCollection.

          Show
          Benjamin Bentmann added a comment - Future plugin versions should probably use the new anno @requiresDependencyCollection .
          Hide
          Adrian Shum added a comment -

          I am encountering the same problem. In a multimodule project, child1 depends on child2. Enforcer plugin failed when it runs on child1, complaining that it cannot resolve child2. I am using Enforcer 1.0-beta1, with Maven 2.2.1.
          Is there any workaround for this?

          Show
          Adrian Shum added a comment - I am encountering the same problem. In a multimodule project, child1 depends on child2. Enforcer plugin failed when it runs on child1, complaining that it cannot resolve child2. I am using Enforcer 1.0-beta1, with Maven 2.2.1. Is there any workaround for this?
          Hide
          Scott Carey added a comment -

          Same problem with 1.0, Maven 3.0.1.

          Tries to locate artifact in local repo when the artifact is part of the current reactor.

          A simple multimodule project and 'mvn enforcer:enforce' fails due to this. It is not bound to any phase, I only want to execute a rule by command line. The rule is sipmle too – enforce that a property (project.version) is set consistently in the project and its children. This should require no more than 'mvn validate' does.

          Show
          Scott Carey added a comment - Same problem with 1.0, Maven 3.0.1. Tries to locate artifact in local repo when the artifact is part of the current reactor. A simple multimodule project and 'mvn enforcer:enforce' fails due to this. It is not bound to any phase, I only want to execute a rule by command line. The rule is sipmle too – enforce that a property (project.version) is set consistently in the project and its children. This should require no more than 'mvn validate' does.
          Hide
          Stefan Rönisch added a comment -

          "mvn release:perform" fails if one multiproject submoduls depends from a another within the same multiproject.

          Show
          Stefan Rönisch added a comment - "mvn release:perform" fails if one multiproject submoduls depends from a another within the same multiproject.
          Hide
          brundibar added a comment -

          We're using maven 2.2.1, but tested also with 3.0.1 - no changes. In our case it's 'package' but also 'javadoc:aggregate' (related to this: http://jira.codehaus.org/browse/MJAVADOC-116).

          • Project structure: -
            Parent P
            child CH1
            child CH2
            ----------------------

          Building P:
          Building CH1: OK
          Building CH2: Failed to resolve artifact: CH1

          The only solution is to use 'install' and put the CH1 to the local repository.

          The priority of this bug is MAJOR, created 3 years ago, can we expect any progress please?? Maybe it's assigned to somebody who's not here any more, can you check it please?

          Thanks,
          Regards

          Show
          brundibar added a comment - We're using maven 2.2.1, but tested also with 3.0.1 - no changes. In our case it's 'package' but also 'javadoc:aggregate' (related to this: http://jira.codehaus.org/browse/MJAVADOC-116 ). Project structure: - Parent P child CH1 child CH2 ---------------------- Building P: Building CH1: OK Building CH2: Failed to resolve artifact: CH1 The only solution is to use 'install' and put the CH1 to the local repository. The priority of this bug is MAJOR, created 3 years ago, can we expect any progress please?? Maybe it's assigned to somebody who's not here any more, can you check it please? Thanks, Regards
          Hide
          Barrie Treloar added a comment -

          Confirmed still an issue with mvn 3.0.4 and enforcer:1.0-alpha-3 as well as with 1.2-SNAPSHOT.

          Why can't you just run install before hand?
          This type of problem is not particular to the enforcer?

          Show
          Barrie Treloar added a comment - Confirmed still an issue with mvn 3.0.4 and enforcer:1.0-alpha-3 as well as with 1.2-SNAPSHOT. Why can't you just run install before hand? This type of problem is not particular to the enforcer?
          Hide
          Robert Scholte added a comment -

          Fixed in r1490991

          Show
          Robert Scholte added a comment - Fixed in r1490991

            People

            • Assignee:
              Robert Scholte
              Reporter:
              Martin Höller
            • Votes:
              14 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: