我使用maven程序集插件为我的项目创建一个zip文件。当我第一次做mvn包时,没有错误。但是通过mvn包做一秒钟我发现错误。怎么做mvn多次没有错误。 在我的脚本maven下面
<!-- Maven assembly plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>frontendArchive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!--My zip.xml file-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>WebContent</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>WebContent</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.*</include>
<include>**/*.zip</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Here is the error that appears for a second time by doing mvn package
C:\User\Projects\frontendWeb>mvn package
C:\User\Projects\frontendWeb>call "C:\Program Files\myDir\bin\maven3\bin\mvn3" package
Running with Maven 3
MAVEN_OPTS=-Dfile.encoding=UTF-8 -Xmx512m -Djava.net.preferIPv4Stack=true
JAVA_HOME=C:\Program Files\Eclipse_DEV\Jdks\jdk1.8
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Portail de services SEPH 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:timestamp-property (get-timestamp-property) @ frontend-web ---
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (filter-resources) @ frontend-web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 23 resources to C:\User\Projects\frontendWeb\WebContent/resources
[INFO] Copying 6 resources to C:\User\Projects\frontendWeb\WebContent
[INFO]
[INFO] --- maven-assembly-plugin:3.0.0:single (frontendArchive) @ frontend-web ---
[INFO] Reading assembly descriptor: src/main/assembly/zip.xml
[ERROR] OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) /
[INFO] Building zip: C:\User\Projects\frontendWeb\WebContent\frontend-web-0.0.1-SNAPSHOT.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.797 s
[INFO] Finished at: 2017-06-26T16:54:38+02:00
[INFO] Final Memory: 13M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.0.0:single (frontendArchive) on project frontend-web: Failed to create assembly: Error creating assembly ar
chive WebContent: A zip file cannot include itself -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\User\Projects\frontendWeb>
答案 0 :(得分:0)