Skip to content

[MASSEMBLY-1001] Excluding pom packaging projects in moduleSet #1208

@jira-importer

Description

@jira-importer

Níno Martínez Wael opened MASSEMBLY-1001 and commented

This is a revisit to:

https://issues.apache.org/jira/browse/MASSEMBLY-676

If a project have pom packaging it will be excluded by module-assembly-plugin, while iterating over projects in moduleSet. So, there is no way to use artifacts, attached to this project.

And revolves around this line:

https://github.com/apache/maven-assembly-plugin/blob/maven-assembly-plugin-3.6.0/src/main/java/org/apache/maven/plugins/assembly/functions/MavenProjects.java#L81

Workaround in old bug report:

use the artifacts as dependencies.

However I could not use this workaround as it takes the dependency from outside the current project reactor set. 

Example

I have a multimodule project where one module builds the assembly and another builds the maven site. Maven site artifact are attached as jar with classifier site.

Layout simplified

Parent

|-module-application 

|-module-site (pom)

|-module-assembly

content of module-assembly pom

        <dependency>
            <groupId>...</groupId>
            <artifactId>module-site</artifactId>
            <type>jar</type>
            <classifier>site</classifier>
        </dependency>

content of assembly descriptor

 

         <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <includes>
                <include>...:module-site</include>
            </includes>
            <binaries>
                <includes>
                    <include>...:module-site:jar:site</include>
                </includes>
                <attachmentClassifier>site</attachmentClassifier>
                <outputDirectory>documentation</outputDirectory>
                <includeDependencies>false</includeDependencies>
                <unpack>true</unpack>
            </binaries>
        </moduleSet>

 

 

The current workaround I use are to get the moduleset included:

By this workaround you will run into

change module-site to the following:

 

    <packaging>jar</packaging>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
related to site plugin when switching to jar package and https://issues.apache.org/jira/browse/MJAR-253                         <id>default-jar</id>
                        <phase>none</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
related to site plugin when using jar packaging                     <allowIncompleteProjects>true</allowIncompleteProjects>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
related to site plugin when using jar packaging                  <allowIncompleteProjects>true</allowIncompleteProjects>
                </configuration>
            </plugin> 

 

 

 

Possible changes that will make it work:

  • make it possible to allow pom modules by a flag on the moduleset
  • Inspect pom module for requested attached binary and allow if any attached

 


Affects: 3.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions