Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何多次使用maven包_Maven - Fatal编程技术网

如何多次使用maven包

如何多次使用maven包,maven,Maven,我使用maven assembly插件为我的项目创建了一个zip文件。当我第一次做mvn包时,没有错误。但有一秒钟,通过执行mvn包,我注意到一个错误。如何在没有错误的情况下多次执行mvn。 下面是我的脚本maven <!-- Maven assembly plugin --> <plugin> <artifactId>maven-assembly-plugin</artif

我使用maven assembly插件为我的项目创建了一个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>

maven汇编插件
3.0.0
前端档案
包裹
单一的
src/main/assembly/zip.xml
假的
网络内容
拉链
假的
网络内容
/
**/*.*
**/*zip先生
下面是执行mvn包第二次出现的错误
C:\User\Projects\frontendWeb>mvn包
C:\User\Projects\frontendWeb>调用“C:\ProgramFiles\myDir\bin\maven3\bin\mvn3”包
与Maven 3一起运行
MAVEN_OPTS=-Dfile.encoding=UTF-8-Xmx512m-Djava.net.preferIPv4Stack=true
JAVA\u HOME=C:\Program Files\Eclipse\u DEV\Jdks\jdk1.8
[信息]正在扫描项目。。。
[信息]
[信息]------------------------------------------------------------------------
[信息]正在构建Portail de services SEPH 0.0.1-SNAPSHOT
[信息]------------------------------------------------------------------------
[信息]
[信息]---构建助手maven插件:3.0.0:timestamp属性(获取timestamp属性)@frontendweb---
[信息]
[信息]---maven资源插件:3.0.2:resources(过滤资源)@frontendweb---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]正在将23个资源复制到C:\User\Projects\frontendWeb\WebContent/resources
[信息]正在将6个资源复制到C:\User\Projects\frontendWeb\WebContent
[信息]
[信息]---maven汇编插件:3.0.0:single(frontendArchive)@FrontEndWeb---
[信息]正在读取程序集描述符:src/main/assembly/zip.xml
[错误]OS=Windows,并且程序集描述符包含*nix特定的根相对引用(以斜杠开始)/
[信息]构建zip:C:\User\Projects\frontendWeb\WebContent\frontend-web-0.0.1-SNAPSHOT.zip
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:1.797秒
[信息]完成时间:2017-06-26T16:54:38+02:00
[信息]最终内存:13M/307M
[信息]------------------------------------------------------------------------
[错误]无法在project frontend web上执行目标org.apache.maven.plugins:maven程序集插件:3.0.0:single(frontendArchive):无法创建程序集:创建程序集时出错
chive WebContent:zip文件不能包含自身->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误][帮助1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\User\Projects\frontendWeb>

您可以在下面的链接中使用配置:-


排除您的zip文件谢谢Jens您的建议很好。欢迎您