Maven构建失败。更新maven(无需修复)构建,为什么?

时间:2016-06-17 22:40:01

标签: java maven

我的系统配置是

  

Apache Maven 3.0.5
  Maven home:D:\ Program Files \ NetBeans 8.1 \ java \ maven
  Java版本:1.7.0_79,供应商:Oracle Corporation
  Java home:D:\ Java \ jdk1.7.0_79 \ jre
  默认语言环境:it_IT,平台编码:Cp1252
  操作系统名称:" Windows 8.1",版本:" 6.3",arch:" amd64",系列:" windows"

当我构建我的maven项目时,它会返回此错误:

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 8.678s
Finished at: Fri Jun 17 20:27:43 CEST 2016
Final Memory: 31M/312M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war (default-war) on project eWheel: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.3:war failed: For artifact {org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:null:jar}: The version cannot be empty. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war (default-war) on project eWheel: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.3:war failed: For artifact {org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:null:jar}: The version cannot be empty.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.3:war failed: For artifact {org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:null:jar}: The version cannot be empty.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.artifact.InvalidArtifactRTException: For artifact {org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:null:jar}: The version cannot be empty.
    at org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:148)
    at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:123)
    at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:157)
    at org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:57)
    at org.apache.maven.repository.legacy.LegacyRepositorySystem.createDependencyArtifact(LegacyRepositorySystem.java:149)
    at org.apache.maven.project.MavenProject.getManagedVersionMap(MavenProject.java:1624)
    at org.apache.maven.project.MavenProject.deepCopy(MavenProject.java:1992)
    at org.apache.maven.project.MavenProject.<init>(MavenProject.java:216)
    at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:501)
    at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:244)
    at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:175)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    ... 20 more


For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

我不明白为什么......

这是我的pom.xml

<properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <!-- clip -->
    <dependencyManagement>
        <dependencies>
            <dependency>  
               <groupId>org.jboss.shrinkwrap.resolver</groupId>  
               <artifactId>shrinkwrap-resolver-impl-maven</artifactId>  
               <scope>test</scope>
            </dependency> 
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.1.11.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!-- clip -->

    <dependencies>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>  
            <groupId>org.primefaces</groupId>  
            <artifactId>primefaces</artifactId>  
            <version>6.0</version>  
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- clip -->
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- clip -->
    </dependencies>

    <profiles>
        <!-- Weld EE embedded profile -->
        <profile>
            <id>arquillian-weld-ee-embedded</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
                    <version>1.0.0.CR3</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.weld</groupId>
                    <artifactId>weld-core</artifactId>
                    <version>1.1.5.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                    <version>1.6.4</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <!-- Weld EE embedded profile -->
        <!-- Glassfish embedded profile -->
        <profile>
            <id>arquillian-glassfish-embedded</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                    <version>1.0.0.CR3</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.main.extras</groupId>
                    <artifactId>glassfish-embedded-all</artifactId>
                    <version>3.1.2</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>arquillian-payara-embedded</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                    <version>1.0.0.CR4</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>fish.payara.extras</groupId>
                    <artifactId>payara-embedded-all</artifactId>
                    <version>4.1.1.161</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <!-- Glassfish embedded profile -->
        <!-- JBoss AS profile -->
        <profile>
            <id>arquillian-jbossas-managed</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-arquillian-container-managed</artifactId>
                    <version>7.1.1.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.protocol</groupId>
                    <artifactId>arquillian-protocol-servlet</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <!-- JBoss AS profile -->
        <!-- remote container Boss AS 7.1 -->
        <profile>
            <id>arquillian-jbossas-remote</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-arquillian-container-remote</artifactId>
                    <version>7.1.1.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.protocol</groupId>
                    <artifactId>arquillian-protocol-servlet</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <!-- remote container Boss AS 7.1 -->
        <!-- remote container Glassfish 3.1.2 -->
        <profile>
            <id>arquillian-glassfish-remote</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.weld</groupId>
                    <artifactId>weld-api</artifactId>
                    <version>1.1.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-remote-3.1</artifactId>
                    <version>1.0.0.CR3</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <!-- remote container Glassfish 3.1.2 -->
        <!-- remote container Payara -->
        <profile>
            <id>arquillian-payara-remote</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.weld</groupId>
                    <artifactId>weld-api</artifactId>
                    <version>1.1.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-remote-3.1</artifactId>
                    <version>1.0.0.CR4</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <!-- remote container payara-->
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

问题是依赖中缺少的版本但是...... 如果我使用maven 3.3.9而不修复它构建......

有人可以帮我理解原因吗?

2 个答案:

答案 0 :(得分:1)

您是否忘记了某个依赖项的版本?

  

对于神器   {org.jboss.shrinkwrap.resolver:拆封 - 旋转变压器,实现了一套Maven的:空:罐子}:   版本不能为空。

我在错误的帖子中评论过,对不起armadinho。

这可能是它 - 禁止以编程方式注入项目依赖项MNG-5818。

答案 1 :(得分:1)

尝试在依赖关系管理中添加版本号。

<dependencyManagement>
    <dependencies>
        <dependency>  
           <groupId>org.jboss.shrinkwrap.resolver</groupId>  
           <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

           <!-- Try adding version here -->
           <version>...</version>

           <scope>test</scope>
        </dependency> 
    </dependencies>
</dependencyManagement>