Matthew Lewis created MASSEMBLY-953:
---------------------------------------

             Summary: Multi-module project build fails when modules are not 
declared in the root project
                 Key: MASSEMBLY-953
                 URL: https://issues.apache.org/jira/browse/MASSEMBLY-953
             Project: Maven Assembly Plugin
          Issue Type: Bug
    Affects Versions: 3.3.0
            Reporter: Matthew Lewis


With this configuration:

root project with multiple modules (parent = bom/pom.xml)
 * bom (no parent)
 * module 1 (parent = root project)
 * module 2 (parent = root project)
 * distribution (parent = root project)

The distribution has a bin.xml file along the lines of:

{{<moduleSets>}}

{{  <moduleSet>}}

{{    <useAllReactorProjects>true</useAllReactorProjects>}}

{{    ...}}

I get warning messages that "The following patterns were never triggered in 
this artifact inclusion filter" and an error "Failed to create assembly: Error 
creating assembly archive bin: archive cannot be empty".

If I add this to the moduleSet:

<includeSubModules>false</includeSubModules>

Then I get a warning that "includeSubModules == false is incompatible with 
useAllReactorProjects. Ignoring." but the build is successful - the flag 
clearly isn't ignored.

I looked into the source code and can see that in ModuleSetAssemblyPhase line 
156 it assumes that the project with the module declaration is 
reactorProjects[0]. I tweaked that line of code to this:

{{// Find the first project to have modules declared}}
{{for ( MavenProject p : configSource.getReactorProjects() )}}
{{{}}
{{ if ( p.getModules().size() > 0 )}}
{{ {}}
{{ project = p;}}
{{ break;}}
{{ }}}
{{}}}

and everything now works without having to resort to setting the 
"includeSubModules" flag to false.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to