Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-102

'attached' goal bound to 'package' phase not working in a multiproject environment when having dependency between its modules

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux (Fedora Core 4)

      Description

      I've noticed the assembly plugin does not work by binding the 'attached' goal to the 'package' phase in a multiproject environment when its modules depend on each other and the local repository is empty.
      To reproduce this issue, please consider the following scenario where M is a multiproject that contains modules A, B, C, D and E (see attached file for the entire project).

      + M

      • A
      • B (depends on A) (uses assembly plugin by binding 'attached' goal to 'package' phase)
      • C (depends on B)
      • D (depends on A)
      • E (depends on D)

      When running 'mvn install' in the project 'M' for the first time, the buid process fails saying that one required artifact is missing (see error below). And it turns out to be D.jar.
      #####################################################################################
      ...
      [INFO] [jar:jar]
      [INFO] Building jar: /l/disk0/devel/assembly/B/target/B-1.1.jar
      Downloading: http://kraz.cpqd.com.br/internal/release/repository/com/mycompany/assembly/D/1.1/D-1.1.jar
      [WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2)
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to resolve artifact.

      Missing:
      ----------
      1) com.mycompany.assembly:jar:1.1

      Try downloading the file manually from the project website.

      Then, install it using the command:
      mvn install:install-file -DgroupId=com.mycompany.assembly -DartifactId=D \
      -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file

      Path to dependency:
      1) com.mycompany.assembly:E:jar:1.1
      2) com.mycompany.assembly:jar:1.1

      ----------
      1 required artifact is missing.

      for artifact:
      com.mycompany.assembly:E:jar:1.1

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)
      #####################################################################################

      It looks like module B triggers the compilation of all modules and when it does that, it happens that E is being compiling but its dependency (D) is not in the local repository yet.
      Please remember to remove the 'com/mycompany/assembly' directory from local repository before running 'mvn install'. Otherwise you won't be able to reproduce the problem.

      Thanks,
      Dário

      1. project_M.tar.gz
        12 kB
        Dário Oliveros

        Issue Links

          Activity

          Hide
          jdcasey John Casey added a comment -

          Use the assembly:single mojo instead of assembly:attached. The attached mojo executes as an aggregator, which means it doesn't proceed through a multimodule build in a normal fashion...it can lead to counterintuitive interdependency problems.

          Show
          jdcasey John Casey added a comment - Use the assembly:single mojo instead of assembly:attached. The attached mojo executes as an aggregator, which means it doesn't proceed through a multimodule build in a normal fashion...it can lead to counterintuitive interdependency problems.
          Hide
          syvalta syvalta added a comment -

          Seems to be the same bug.

          Show
          syvalta syvalta added a comment - Seems to be the same bug.

            People

            • Assignee:
              jdcasey John Casey
              Reporter:
              oliveros Dário Oliveros
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development