我正在尝试使用maven-assembly-plugin
将我的项目打包到.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>
myProjectConf.xml
具有以下内容:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.0.0 http://maven.apache.org/xsd/assembly-3.0.0.xsd">
<formats>
<format>tar</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/main</directory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
<outputDirectory>${project.basedir}/target/packagedFiles</outputDirectory>
</fileSet>
<fileSet>
<directory>src/test</directory>
<outputDirectory>${project.basedir}/target/packagedFiles</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/lib</directory>
<outputDirectory>${project.basedir}/target/packagedFiles</outputDirectory>
</fileSet>
</fileSets>
</assembly>
不过,我没羞没臊;
[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]
我看了这个类似的问题How to prevent 'Error creating assembly archive distribution: A zip file cannot include itself',因此我将<excludes>
添加到我的项目中,正如您在上面看到的。
但错误消息没有任何变化。
1条答案
按热度按时间4nkexdtk1#
我通过添加“maven-clean-plugin”解决了此问题。