Maven
  1. Maven
  2. MNG-2054

Multiple Inheritence causes plugin executions to run multiple times (Test Case Attached)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.4
    • Labels:
      None
    • Environment:
      WinXp

      Description

      See the attached sample. If a plugin execution is set in a parent of a parent, when the child is built from either aggregator, the plugin execution runs multiple times. In my sample, I set the sources to be generated, but when run, see that the sources are generated and installed 2x.

      [INFO] Building jar: E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-tests.jar
      [INFO] [install:install]
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT.jar to f:\mavenRepo\sampl
      e-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT.jar
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-sources.jar to f:\mavenRe
      po\sample-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT-sources.jar
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-sources.jar to f:\mavenRe
      po\sample-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT-sources.jar
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-tests.jar to f:\mavenRepo
      \sample-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT-tests.jar
      [INFO]

      If run directly from the child build, the sources are only built 1x:
      [INFO] [jar:jar]
      [INFO] Building jar: E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT.jar
      [INFO] [source:jar

      {execution: attach-source}

      ]
      [INFO] Building jar: E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-sources.jar
      [INFO] [jar:test-jar

      {execution: default}

      ]
      [INFO] Building jar: E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-tests.jar
      [INFO] [install:install]
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT.jar to f:\mavenRepo\sampl
      e-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT.jar
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-sources.jar to f:\mavenRe
      po\sample-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT-sources.jar
      [INFO] Installing E:\STC\sample\sample-parent2\sample-jar\target\sample-jar-SNAPSHOT-tests.jar to f:\mavenRepo
      \sample-project\sample-jar\SNAPSHOT\sample-jar-SNAPSHOT-tests.jar

      1. sample-regression.zip
        19 kB
        Brian Fox
      2. sample.zip
        6 kB
        Brian Fox
      3. antrun2.tgz
        0.7 kB
        kenneyw

        Issue Links

          Activity

          Hide
          Brian E. Fox added a comment -

          Further investigation using help:effective-pom shows that the plugin configuration actually gets included 2x in the pom. Shouldn't executions with the same name be merged with their parent?

          Show
          Brian E. Fox added a comment - Further investigation using help:effective-pom shows that the plugin configuration actually gets included 2x in the pom. Shouldn't executions with the same name be merged with their parent?
          Hide
          Brian E. Fox added a comment -

          I verified in my sample and in my real project that this appears to be fixed in 2.0.3. The fixed version should be updated so that the JIRA report reflects the correct information. I'd like to see this get created as an integration test to prevent future regresion, but I'm not 100% sure how to test for this condition.

          Show
          Brian E. Fox added a comment - I verified in my sample and in my real project that this appears to be fixed in 2.0.3. The fixed version should be updated so that the JIRA report reflects the correct information. I'd like to see this get created as an integration test to prevent future regresion, but I'm not 100% sure how to test for this condition.
          Hide
          John Casey added a comment -

          confirmed fixed by Brian Fox, I just added a variant of sample.zip as it0096.

          Show
          John Casey added a comment - confirmed fixed by Brian Fox, I just added a variant of sample.zip as it0096.
          Hide
          Brian E. Fox added a comment -

          There was some regression on this issue between the RC and the final version. In 2.0.2, the sample ran the sources jar 3 times. In 2.0.3 RC, it ran only once (correct). In 2.0.3 final it now runs 2 times:

          [INFO] Installing E:\svn\dsms-2.1\legacy\hl7\target\hl7-2.1.0.7-SNAPSHOT.jar to
          e:\stc\mavenRepo\com\stchome\products\dsms\legacy\hl7\2.1.0.7-SNAPSHOT\hl7-2.1.0
          .7-SNAPSHOT.jar
          [INFO] Installing E:\svn\dsms-2.1\legacy\hl7\target\hl7-2.1.0.7-SNAPSHOT-sources
          .jar to e:\stc\mavenRepo\com\stchome\products\dsms\legacy\hl7\2.1.0.7-SNAPSHOT\h
          l7-2.1.0.7-SNAPSHOT-sources.jar
          [INFO] Installing E:\svn\dsms-2.1\legacy\hl7\target\hl7-2.1.0.7-SNAPSHOT-sources
          .jar to e:\stc\mavenRepo\com\stchome\products\dsms\legacy\hl7\2.1.0.7-SNAPSHOT\h
          l7-2.1.0.7-SNAPSHOT-sources.jar

          Show
          Brian E. Fox added a comment - There was some regression on this issue between the RC and the final version. In 2.0.2, the sample ran the sources jar 3 times. In 2.0.3 RC, it ran only once (correct). In 2.0.3 final it now runs 2 times: [INFO] Installing E:\svn\dsms-2.1\legacy\hl7\target\hl7-2.1.0.7-SNAPSHOT.jar to e:\stc\mavenRepo\com\stchome\products\dsms\legacy\hl7\2.1.0.7-SNAPSHOT\hl7-2.1.0 .7-SNAPSHOT.jar [INFO] Installing E:\svn\dsms-2.1\legacy\hl7\target\hl7-2.1.0.7-SNAPSHOT-sources .jar to e:\stc\mavenRepo\com\stchome\products\dsms\legacy\hl7\2.1.0.7-SNAPSHOT\h l7-2.1.0.7-SNAPSHOT-sources.jar [INFO] Installing E:\svn\dsms-2.1\legacy\hl7\target\hl7-2.1.0.7-SNAPSHOT-sources .jar to e:\stc\mavenRepo\com\stchome\products\dsms\legacy\hl7\2.1.0.7-SNAPSHOT\h l7-2.1.0.7-SNAPSHOT-sources.jar
          Hide
          John Casey added a comment -

          Brian,

          Can you tell me what the key difference is between your project above (dsms-2.1, looks like?) and it0096, which is based on the sample.zip?

          I just re-downloaded sample.zip, and it works fine on this side (running with a copy of mvn I downloaded this morning).

          Show
          John Casey added a comment - Brian, Can you tell me what the key difference is between your project above (dsms-2.1, looks like?) and it0096, which is based on the sample.zip? I just re-downloaded sample.zip, and it works fine on this side (running with a copy of mvn I downloaded this morning).
          Hide
          Brett Porter added a comment -

          Brian, also please detail exactly which RC you are using (time/date). I don't believe anything was changed between the last one and the release.

          Show
          Brett Porter added a comment - Brian, also please detail exactly which RC you are using (time/date). I don't believe anything was changed between the last one and the release.
          Hide
          Brian E. Fox added a comment -

          I was running with 2.0.3-SNAPSHOT that was built on March 2nd. I believe this was one of the earlier RCs.

          I also noticed that the sample seems to work even though it was based on my original project, which doesn't work. I'll go back and see if I can figure out the difference.

          Show
          Brian E. Fox added a comment - I was running with 2.0.3-SNAPSHOT that was built on March 2nd. I believe this was one of the earlier RCs. I also noticed that the sample seems to work even though it was based on my original project, which doesn't work. I'll go back and see if I can figure out the difference.
          Hide
          Brian E. Fox added a comment -

          Apparently the only difference is the number of levels between the plugin definition to the child. This updated sample now produces 3 or more executions of the sources jar

          The only difference between this version and the previous sample is an additional inheritence level.

          Show
          Brian E. Fox added a comment - Apparently the only difference is the number of levels between the plugin definition to the child. This updated sample now produces 3 or more executions of the sources jar The only difference between this version and the previous sample is an additional inheritence level.
          Hide
          Kenney Westerhof added a comment -

          This test shows multiple calls of the same goals. Try 'mvn clean', 'mvn generate-sources', 'mvn package'.
          It contains a parent and a child pom, and when run from the parent pom there are multiple executions of the same
          goals:

          $ mvn -version
          Maven version: 2.0.4-SNAPSHOT

          (http://maven.zones.apache.org/~maven/builds/branches/maven-2.0.x/m2-20060330.155710.tar.gz)

          $ mvn clean

          [INFO] Scanning for projects...
          [INFO] Reactor build order:
          [INFO] parent
          [INFO] child
          [INFO] ----------------------------------------------------------------------------
          [INFO] Building parent
          [INFO] task-segment: [clean]
          [INFO] ----------------------------------------------------------------------------
          [INFO] [clean:clean]
          [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/target
          [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/target/classes
          [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/target/test-classes
          [INFO] [antrun:run

          {execution: test2}

          ]
          [INFO] Executing tasks
          [echo] test2
          [INFO] Executed tasks
          [INFO] ----------------------------------------------------------------------------
          [INFO] Building child
          [INFO] task-segment: [clean]
          [INFO] ----------------------------------------------------------------------------
          [INFO] [clean:clean]
          [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/child/target
          [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/child/target/classes
          [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/child/target/test-classes
          [INFO] [antrun:run

          {execution: test2}

          ]
          [INFO] Executing tasks
          [echo] test2
          [INFO] Executed tasks
          [INFO] [antrun:run

          {execution: childTest2}

          ]
          [INFO] Executing tasks
          [echo] childTest2
          [INFO] Executed tasks
          [INFO] [antrun:run

          {execution: test2}

          ]
          [INFO] Executing tasks
          [echo] test2
          [INFO] Executed tasks
          [INFO] [antrun:run

          {execution: childTest2}

          ]
          [INFO] Executing tasks
          [echo] childTest2
          [INFO] Executed tasks
          [INFO]
          [INFO]
          [INFO] ------------------------------------------------------------------------
          [INFO] Reactor Summary:
          [INFO] ------------------------------------------------------------------------
          [INFO] parent ................................................ SUCCESS [1.022s]
          [INFO] child ................................................. SUCCESS [0.069s]
          [INFO] ------------------------------------------------------------------------
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD SUCCESSFUL
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 1 second
          [INFO] Finished at: Fri Mar 31 14:18:10 CEST 2006
          [INFO] Final Memory: 2M/6M
          [INFO] ------------------------------------------------------------------------

          Show
          Kenney Westerhof added a comment - This test shows multiple calls of the same goals. Try 'mvn clean', 'mvn generate-sources', 'mvn package'. It contains a parent and a child pom, and when run from the parent pom there are multiple executions of the same goals: $ mvn -version Maven version: 2.0.4-SNAPSHOT ( http://maven.zones.apache.org/~maven/builds/branches/maven-2.0.x/m2-20060330.155710.tar.gz ) $ mvn clean [INFO] Scanning for projects... [INFO] Reactor build order: [INFO] parent [INFO] child [INFO] ---------------------------------------------------------------------------- [INFO] Building parent [INFO] task-segment: [clean] [INFO] ---------------------------------------------------------------------------- [INFO] [clean:clean] [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/target [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/target/classes [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/target/test-classes [INFO] [antrun:run {execution: test2} ] [INFO] Executing tasks [echo] test2 [INFO] Executed tasks [INFO] ---------------------------------------------------------------------------- [INFO] Building child [INFO] task-segment: [clean] [INFO] ---------------------------------------------------------------------------- [INFO] [clean:clean] [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/child/target [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/child/target/classes [INFO] Deleting directory /vol/home/forge/work/sandbox/m2test/antrun2/child/target/test-classes [INFO] [antrun:run {execution: test2} ] [INFO] Executing tasks [echo] test2 [INFO] Executed tasks [INFO] [antrun:run {execution: childTest2} ] [INFO] Executing tasks [echo] childTest2 [INFO] Executed tasks [INFO] [antrun:run {execution: test2} ] [INFO] Executing tasks [echo] test2 [INFO] Executed tasks [INFO] [antrun:run {execution: childTest2} ] [INFO] Executing tasks [echo] childTest2 [INFO] Executed tasks [INFO] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] ------------------------------------------------------------------------ [INFO] parent ................................................ SUCCESS [1.022s] [INFO] child ................................................. SUCCESS [0.069s] [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Fri Mar 31 14:18:10 CEST 2006 [INFO] Final Memory: 2M/6M [INFO] ------------------------------------------------------------------------
          Hide
          Brian E. Fox added a comment -

          This does seem some how related, but it's not quite the same. The original problem I saw was just the executions defined in the parent got executed a bunch of times. In your case, some of the child executions are rerun too.

          Show
          Brian E. Fox added a comment - This does seem some how related, but it's not quite the same. The original problem I saw was just the executions defined in the parent got executed a bunch of times. In your case, some of the child executions are rerun too.
          Hide
          Brett Porter added a comment -

          Kenney, please file a new bug.

          Show
          Brett Porter added a comment - Kenney, please file a new bug.
          Hide
          Stephen Duncan Jr added a comment -

          I've filed http://jira.codehaus.org/browse/MNG-2221 which I think is the same as Kenney's.

          Show
          Stephen Duncan Jr added a comment - I've filed http://jira.codehaus.org/browse/MNG-2221 which I think is the same as Kenney's.

            People

            • Assignee:
              Brett Porter
              Reporter:
              Brian E. Fox
            • Votes:
              2 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development