2013-07-24 48 views
5

我試圖從網上安裝原型版,需要執行mvn maven-dependency-plugin:2.8:copy。由於錯誤重新啓動版本,它不工作。我的本地版本也有一個正確的版本,存放在我的服務器上。我的mvn捆綁到我的服務器上。解決插件'maven-dependency-plugin的版本時出錯:2.8'

出了什麼問題?

錯誤消息:

mvn -e maven-dependency-plugin:2.8:copy 
[INFO] Error stacktraces are turned on. 
[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.131s 
[INFO] Finished at: Wed Jul 24 11:15:01 CEST 2013 
[INFO] Final Memory: 5M/149M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Error resolving version for plugin 'maven-dependency-plugin:2.8' from the repositories [local (/home/argonist/.m2/repository), nexus (http://10.8.1.1:8081/nexus/content/groups/public)]: Plugin not found in any plugin repository -> [Help 1] 
org.apache.maven.plugin.version.PluginVersionResolutionException: Error resolving version for plugin 'maven-dependency-plugin:2.8' from the repositories [local (/home/argonist/.m2/repository), nexus (http://10.8.1.1:8081/nexus/content/groups/public)]: Plugin not found in any plugin repository 
    at org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.selectVersion(DefaultPluginVersionResolver.java:237) 
    at org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.resolveFromRepository(DefaultPluginVersionResolver.java:149) 
    at org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.resolve(DefaultPluginVersionResolver.java:97) 
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.resolvePluginVersion(MojoDescriptorCreator.java:277) 
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:232) 
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106) 
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:86) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:98) 
    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) 
[ERROR] 
[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/PluginVersionResolutionException 

庫本地:

ll /home/argonist/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/2.8/ 
insgesamt 188 
drwxrwxr-x 2 argonist argonist 4096 Jul 24 10:24 ./ 
drwxrwxr-x 5 argonist argonist 4096 Jul 24 10:23 ../ 
-rw-rw-r-- 1 argonist argonist 107 Jul 24 11:14 m2e-lastUpdated.properties 
-rw-rw-r-- 1 argonist argonist 153185 Jul 24 10:23 maven-dependency-plugin-2.8.jar 
-rw-rw-r-- 1 argonist argonist  40 Jul 24 10:23 maven-dependency-plugin-2.8.jar.sha1 
-rw-rw-r-- 1 argonist argonist 11454 Jul 24 10:23 maven-dependency-plugin-2.8.pom 
-rw-rw-r-- 1 argonist argonist  40 Jul 24 10:23 maven-dependency-plugin-2.8.pom.sha1 
-rw-rw-r-- 1 argonist argonist 205 Jul 24 10:23 _maven.repositories 

更新

mvn -e org.apache.maven.plugins:maven-dependency-plugin:2.8:copy 
[INFO] Error stacktraces are turned on. 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:copy (default-cli) @ standalone-pom --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.416s 
[INFO] Finished at: Wed Jul 24 17:15:39 CEST 2013 
[INFO] Final Memory: 9M/149M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Either artifact or artifactItems is required -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Either artifact or artifactItems is required 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) 
    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.MojoFailureException: Either artifact or artifactItems is required 
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.verifyRequirements(AbstractFromConfigurationMojo.java:125) 
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.doExecute(CopyMojo.java:103) 
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:167) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    ... 19 more 
[ERROR] 
[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/MojoFailureException 

更新

的pom.xml

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>org.glassfish.samples</groupId> 
    <artifactId>javaee7-jms-websocket-example</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <name>javaee7-jms-websocket-example</name> 

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

    <dependencies> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>io.undertow</groupId> 
      <artifactId>undertow-websockets-jsr</artifactId> 
      <version>1.0.0.Alpha13</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.0</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.8</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> 

回答

0

之前在本地資源庫進行搜索,行家搜尋SEARCH_TERM_EXAMPLES這個插件爲您的Nexus神器庫,即住在:

http://10.8.1.1:8081/nexus/content/groups/public 

例外:

Plugin not found in any plugin repository 

但未找到。將工件放入Nexus中,maven將其下載到本地存儲庫。

+0

但我在庫中發現它。這裏:/nexus/content/groups/public/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.jar – argonist

+0

這個存儲庫是否設置爲public?我認爲你必須把存儲庫放在公共組中才可以訪問 – Emilio

+0

它是公開的其他庫,也是公共組。我可以通過firefox訪問那個lib而不用登錄。這是奇怪的 – argonist

1

試試這個..你應該給完全合格的名稱即的groupId:artifactId的:版本

mvn -e org.apache.maven.plugins:maven-dependency-plugin:2.8:copy 

更多參考請參閱Maven的中央回購。

http://search.maven.org/#search|ga|1|maven-dependency-plugin

+0

我試過了。往上看。 – argonist

+0

如果您第一次看到日誌,它無法找到插件本身,因爲第二次執行它時現在缺少groupId,所以您沒有提及任何要複製的工件。 請通過此鏈接。 http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html – saurav

+0

我用我的pom.xml檢查了它。這是相同的。我不明白爲什麼它不能找到插件。我可以在聯繫中找到它。它也在公共團體中。 – argonist

0

我有同樣的問題在maven-failsafe-plugin。我爲該插件指定了一個版本(請參閱this answer)。

相關問題