Java 未能创建程序集:创建程序集存档时出错空:tar文件不能包含自身

Java 未能创建程序集:创建程序集存档时出错空:tar文件不能包含自身,java,maven,Java,Maven,我正在尝试使用maven汇编插件将我的项目打包到.tar文件中 我已将以下插件添加到我的pom.xml文件中: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration>

我正在尝试使用
maven汇编插件
将我的项目打包到
.tar
文件中

我已将以下插件添加到我的
pom.xml
文件中:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptor>src/assembly/myProjectConf.xml</descriptor>
                <finalName>my-project-${version}</finalName>
                <excludes>
                    <exclude>**/*.zip</exclude>
                    <exclude>**/*.tar</exclude>
                </excludes>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
然而,我得到了

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default) on project job-manager: Failed to create assembly: Error creating assembly archive null: A tar file cannot include itself. -> [Help 1]
我看了这个类似的问题,因此我将
添加到我的项目中,正如您在上面看到的


但是错误消息没有改变。

我通过添加“maven clean plugin”解决了这个问题


maven清洁插件
3.1.0
自动清洗
初始化
清洁的

首先,您使用的是非常旧的版本。。。您应该升级到3.0.0。然后你有一个
,没有
,不确定这是做什么的,但它可能包括basedir下的所有内容,这就是问题所在。另外,
不存在,因此配置被完全忽略,并且
已被删除,请改用
。1.我将版本升级到3.0.0 2.我删除了
,但没有
。我仍然有同样的问题,请张贴更新的POM和组装描述符。确保同时运行
mvn clean package
。啊,是的,那是正常的
mvn程序集:程序集
长期不推荐使用,应使用
assembly:single
。但始终更喜欢使用
阶段…查看
而不是
,请参见此处
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default) on project job-manager: Failed to create assembly: Error creating assembly archive null: A tar file cannot include itself. -> [Help 1]
<plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>auto-clean</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>