You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Matthew Lewis (Jira)" <ji...@apache.org> on 2021/05/18 08:32:00 UTC
[jira] [Updated] (MASSEMBLY-953) Multi-module project build fails
when modules are not declared in the root project
[ https://issues.apache.org/jira/browse/MASSEMBLY-953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthew Lewis updated MASSEMBLY-953:
------------------------------------
Description:
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.
was:
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.
> 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
> Priority: Minor
> Attachments: ModuleSetAssemblyPhase.java
>
>
> 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)