Maven 程序集将 jar-with-dependencies 放入 tar.gz 包中

Maven assembly put jar-with-dependencies into tar.gz package

我是用maven assembly plugin打包一个fat jar,然后想把fat jar放到tar.gz包里,也是mvn-assembly plugin生成的
问题是 assembly 不会将 fat jar 放入 tar 文件,而是放入 small jar,它只包含代码而没有依赖项。
这是我的 pom 文件:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.5</version>
            <configuration>
                <descriptor>src/main/resources-local/assembly.xml</descriptor>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>my.App</mainClass>
                    </manifest>
                </archive>
                <outputDirectory>output</outputDirectory>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

和assembly.xml:

<id>release</id>
<formats>
    <format>tar.gz</format>
</formats>

<dependencySets>
    <dependencySet>
        <outputDirectory>/lib</outputDirectory>
        <includes>
            <include>*:project:*:*</include>
        </includes>
        <useProjectArtifact>true</useProjectArtifact>
        <unpack>false</unpack>
        <scope>runtime</scope>
    </dependencySet>
</dependencySets>

解决了这个问题

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
        <version>2.5.5</version>
        <executions>
                <execution>
                    <id>make-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <finalName>project-${version}</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                    </configuration>
                </execution>
                <execution>
                    <id>make-tar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <descriptor>src/main/resources-local/assembly.xml</descriptor>
                        <archive>
                            <manifest>
                                <mainClass>my.App</mainClass>
                            </manifest>
                        </archive>
                        <outputDirectory>output</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </executions>
    </plugin>