Wie konfiguriere ich das Maven-Schatten-Plugin in einem Projekt mit mehreren Modulen?

jedermann! Ich habe versucht, mit dem Maven Shade Plugin ein Glas zu bekommen, aber ich verstehe immer noch keinen Erfolg :(

Das ist meine Projektstruktur:

MainModule
  -Module1
    -src
    -pom.xml
  -Module2
    -src
    -pom.xml
  -pom.xml

Modul1 (pom.xml):

<parent>
    <artifactId>MainModule</artifactId>
    <groupId>com.plugintest</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Module1</artifactId>

Modul 2 (pom.xml):

<parent>
    <artifactId>MainModule</artifactId>
    <groupId>com.plugintest</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Module1</artifactId>

Hauptmodul (pom.xml):

<groupId>com.plugintest</groupId>
<artifactId>MainModule</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
    <module>Module1</module>
    <module>Module2</module>
</modules>
<build>
    <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.2</version>
        <executions>
            <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            </execution>
        </executions>
        </plugin>
    </plugins>
</build>

Nach diesem Code erhalte ich 2 JAR-Dateien (Module1-version.jar und Module2-version.jar). Aber es ist nicht das, was ich will. Ich möchte eine JAR-Datei (MainModule-version.jar) erhalten, die die andere enthält (Module1 und Module2).

Bitte sag mir, warum funktioniert dieses Shade Plugin nicht?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage