Skip to content

<dependencySet> for <assembly> does not correctly resolve reactor artifacts when org.codehaus.mojo:license-maven-plugin has run before #1856

@f-wunderlich

Description

@f-wunderlich

Something like

<dependencySet>
  <outputDirectory>dependencies</outputDirectory>
  <includes>
    <include>some:reactor.dependency</include>
  </includes>
  <outputFileNameMapping>webapp.war</outputFileNameMapping>
</dependencySet>

fails when this artifact is not present in the local repository but built during a Maven reactor build when license-maven-plugin has run before. Thus,

rm -r ~/.m2/repository/some/reactor.dependency ; mvn clean install

will fail with

[ERROR] DOCKER> Failed to create assembly for docker image  (with mode 'dir'): Error adding file 'some:reactor.dependency:war:1.0-SNAPSHOT' to archive: /home/[...] isn't a file.. If you include the build artifact please ensure that you have built the artifact before with 'mvn package' (should be available in the target/ dir). Please see the documentation (section "Assembly") for more information.

It seems that the license-maven-plugin will trigger an early dependency resolution and if that doesn't find the specified artifact in the local repository, then resolution from the reactor build will fail. Disabling that plugin execution will cause the build to succeed, as will including the artifact with <file> instead.

Latest version used for all plugins. In the failure case, Maven also displays:

WARNING: The following dependencies could not be resolved at this point of the build but seem to be part of the     
reactor:                                                                                                            
WARNING: o some:reactor.dependency:war:1.0-SNAPSHOT (compile)                                                       
WARNING: Try running the build up to the lifecycle phase "package"                                                  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions