我正在尝试使用maven程序集插件创建单个胖jar但不知何故在运行 maven clean install 之后它给了2个jar,一个是client-1.0-SNAPSHOT.jar,另一个是client-1.0-SNAPSHOT-jar-with-dependencies.jar .

我只对创建一个带有依赖项的jar感兴趣,所以不知道为什么另一个jar也是由这个汇编插件创建的 . 有人能告诉我如何消除这个jar或者我应该使用其他maven命令而不是干净安装?

<build>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <excludes>
                    <exclude>*.properties</exclude>
                </excludes>
            </resource>
        </resources>

        <plugins>

            <!-- download source code in Eclipse, best practice -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>
                </configuration>
            </plugin>

            <!-- Set a compiler level -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                </configuration>
            </plugin>

            <!-- Maven Assembly Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <!-- get all project dependencies -->
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    -->
                    <!-- MainClass in mainfest make a executable jar -->
                    <archive>
                        <manifest>
                            <mainClass>com.app.MainApp</mainClass>
                        </manifest>
                    </archive>

                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <!-- bind to the packaging phase -->
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <!-- overwrite! -->
                            <overwrite>true</overwrite>
                            <outputDirectory>${project.basedir}/target</outputDirectory>
                            <resources>

                                <resource>
                                    <directory>${project.basedir}/</directory>
                                    <includes>
                                        <include>*.properties</include>
                                    </includes>
                                </resource>

                            </resources>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
        </plugins>
    </build>