为什么我不能从本地存储库部署到远程Maven存储库?

时间:2013-01-08 20:11:51

标签: maven deployment repository

我正在使用Maven 3.0.4并希望将我本地存储库中的内容部署到远程存储库,我已经验证了我可以访问的存储库。我使用以下命令...

mvn -X deploy:deploy-file -DgroupId=org.directwebremoting -DartifactId=dwr  -Dversion=3.0.0-rc2 -Dpackaging=jar -Dfile=/Users/davea/.m2/repository//org/directwebremoting/dwr/3.0.0-rc2/dwr-3.0.0-rc2.jar  -Durl=dav:https://repository-myco.forge.cloudbees.com/private  -DrepositoryId=cloudbees-private

但是我收到了这个无用的错误消息。任何想法我还应该检查什么?错误之后是我的〜.m2 / settings.xml文件。

Apache Maven 3.0.4 (r1232337; 2012-01-17 02:44:56-0600) 
Maven home: /opt/apache-maven-3.0.4 
Java version: 1.6.0_37, vendor: Apple Inc.  
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 
Default locale: en_US, platform encoding: MacRoman  
OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"   
[INFO] Error stacktraces are turned on. 
[DEBUG] Reading global settings from /opt/apache-maven-3.0.4/conf/settings.xml  
[DEBUG] Reading user settings from /Users/davea/.m2/settings.xml    
[DEBUG] Using local repository at /Users/davea/.m2/repository   
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /Users/davea/.m2/repository   
[INFO] Scanning for projects... 
[DEBUG] Extension realms for project org.mainco.subco:myproject:war:1.0-SNAPSHOT: (none)    
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]   
[DEBUG] Resolving plugin prefix deploy from [org.apache.maven.plugins, org.codehaus.mojo]   
[DEBUG] Resolved plugin prefix deploy to org.apache.maven.plugins:maven-deploy-plugin from POM org.mainco.subco:myproject:war:1.0-SNAPSHOT  
[DEBUG] === REACTOR BUILD PLAN ================================================ 
[DEBUG] Project: org.mainco.subco:myproject:war:1.0-SNAPSHOT    
[DEBUG] Tasks:   [deploy:deploy-file]   
[DEBUG] Style:   Aggregating    
[DEBUG] ======================================================================= 
[INFO]                                                                          
[INFO] ------------------------------------------------------------------------ 
[INFO] Building myproject-war 1.0-SNAPSHOT  
[INFO] ------------------------------------------------------------------------ 
[DEBUG] Resolving plugin prefix deploy from [org.apache.maven.plugins, org.codehaus.mojo]   
[DEBUG] Resolved plugin prefix deploy to org.apache.maven.plugins:maven-deploy-plugin from POM org.mainco.subco:myproject:war:1.0-SNAPSHOT  
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]   
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]   
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]  
[DEBUG] === PROJECT BUILD PLAN ================================================ 
[DEBUG] Project:       org.mainco.subco:myproject:1.0-SNAPSHOT  
[DEBUG] Dependencies (collect): []  
[DEBUG] Dependencies (resolve): []  
[DEBUG] Repositories (dependencies): [cloudbees-private (https://repository-myco.forge.cloudbees.com/private/, releases+snapshots), maven2-repository.dev.java.net (http://download.java.net/maven/2/, releases), central (http://repo.maven.apache.org/maven2, releases)]  
[DEBUG] Repositories (plugins)     : [repository.jboss.org_thirdparty-releases (https://repository.jboss.org/nexus/content/repositories/thirdparty-releases, releases), repository.jboss.org_thirdparty-uploads (https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads, releases), central (http://repo.maven.apache.org/maven2, releases)]    
[DEBUG] ----------------------------------------------------------------------- 
[DEBUG] Goal:          org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli)   
[DEBUG] Style:         Regular  
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>   
<configuration> 
  <artifactId>${artifactId}</artifactId>    
  <classifier>${classifier}</classifier>    
  <classifiers>${classifiers}</classifiers> 
  <description>${generatePom.description}</description> 
  <file>${file}</file>  
  <files>${files}</files>   
  <generatePom default-value="true">${generatePom}</generatePom>    
  <groupId>${groupId}</groupId> 
  <javadoc>${javadoc}</javadoc> 
  <localRepository default-value="${localRepository}"/> 
  <offline default-value="${settings.offline}"/>    
  <packaging>${packaging}</packaging>   
  <pomFile>${pomFile}</pomFile> 
  <project default-value="${project}"/> 
  <repositoryId default-value="remote-repository">${repositoryId}</repositoryId>    
  <repositoryLayout default-value="default">${repositoryLayout}</repositoryLayout>  
  <retryFailedDeploymentCount default-value="1">${retryFailedDeploymentCount}</retryFailedDeploymentCount>  
  <sources>${sources}</sources> 
  <types>${types}</types>   
  <uniqueVersion default-value="true">${uniqueVersion}</uniqueVersion>  
  <updateReleaseInfo default-value="false">${updateReleaseInfo}</updateReleaseInfo> 
  <url>${url}</url> 
  <version>${version}</version> 
</configuration>    
[DEBUG] ======================================================================= 
[INFO]  
[INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) @ myproject ---    
[DEBUG] Created new class realm maven.api   
[DEBUG] Importing foreign packages into class realm maven.api   
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core 
[DEBUG]   Imported: org.sonatype.aether.transfer < plexus.core  
[DEBUG]   Imported: org.apache.maven.exception < plexus.core    
[DEBUG]   Imported: org.sonatype.aether.metadata < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core  
[DEBUG]   Imported: org.sonatype.aether.collection < plexus.core    
[DEBUG]   Imported: org.sonatype.aether.version < plexus.core   
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core 
[DEBUG]   Imported: org.apache.maven.repository < plexus.core   
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core   
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core   
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core 
[DEBUG]   Imported: org.sonatype.aether.repository < plexus.core    
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core   
[DEBUG]   Imported: org.apache.maven.execution < plexus.core    
[DEBUG]   Imported: org.sonatype.aether.artifact < plexus.core  
[DEBUG]   Imported: org.sonatype.aether.spi < plexus.core   
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core    
[DEBUG]   Imported: org.apache.maven.usability < plexus.core    
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core 
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core 
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core   
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core 
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core    
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core   
[DEBUG]   Imported: org.sonatype.aether.graph < plexus.core 
[DEBUG]   Imported: org.sonatype.aether.* < plexus.core 
[DEBUG]   Imported: org.apache.maven.settings < plexus.core 
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core  
[DEBUG]   Imported: org.sonatype.aether.impl < plexus.core  
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core  
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core    
[DEBUG]   Imported: org.sonatype.aether.deployment < plexus.core    
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core   
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core    
[DEBUG]   Imported: org.apache.maven.cli < plexus.core  
[DEBUG]   Imported: org.sonatype.aether.installation < plexus.core  
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core   
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core  
[DEBUG]   Imported: org.apache.maven.project < plexus.core  
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core   
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core 
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core 
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core 
[DEBUG]   Imported: org.apache.maven.model < plexus.core    
[DEBUG]   Imported: org.apache.maven.* < plexus.core    
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core  
[DEBUG]   Imported: org.sonatype.aether.resolution < plexus.core    
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core   
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core 
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core   
[DEBUG] Populating class realm maven.api    
[DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:2.7:   
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile  
[DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile 
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.6:compile 
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile  
[DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.0.6:compile 
[DEBUG]          org.apache.maven:maven-repository-metadata:jar:2.0.6:compile   
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile  
[DEBUG]       org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile 
[DEBUG]          junit:junit:jar:3.8.1:compile  
[DEBUG]          classworlds:classworlds:jar:1.1-alpha-2:compile    
[DEBUG]    org.apache.maven:maven-model:jar:2.0.6:compile   
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile    
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:1.5.6:compile   
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7 
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7 
[DEBUG]   Imported:  < maven.api    
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7  
[DEBUG]   Included: org.apache.maven.plugins:maven-deploy-plugin:jar:2.7    
[DEBUG]   Included: junit:junit:jar:3.8.1   
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.5.6  
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6 
[DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6    
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6   
[DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6    
[DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6   
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6    
[DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6    
[DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1   
[DEBUG]   Excluded: classworlds:classworlds:jar:1.1-alpha-2 
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6  
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6   
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7, parent: sun.misc.Launcher$AppClassLoader@69cd2e5f]  
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file' with basic configurator --> 
[DEBUG]   (f) artifactId = dwr  
[DEBUG]   (f) file = /Users/davea/.m2/repository/org/directwebremoting/dwr/3.0.0-rc2/dwr-3.0.0-rc2.jar  
[DEBUG]   (f) generatePom = true    
[DEBUG]   (f) groupId = org.directwebremoting   
[DEBUG]   (s) localRepository =        id: local    
      url: file:///Users/davea/.m2/repository/  
   layout: none 

[DEBUG]   (f) offline = false   
[DEBUG]   (f) packaging = jar   
[DEBUG]   (f) project = MavenProject: org.mainco.subco:myproject:1.0-SNAPSHOT @ /Users/davea/Dropbox/workspace/myproject/pom.xml    
[DEBUG]   (f) repositoryId = cloudbees-private  
[DEBUG]   (f) repositoryLayout = default    
[DEBUG]   (f) retryFailedDeploymentCount = 1    
[DEBUG]   (f) uniqueVersion = true  
[DEBUG]   (f) updateReleaseInfo = false 
[DEBUG]   (f) url = dav:https://repository-myco.forge.cloudbees.com/private 
[DEBUG]   (f) version = 3.0.0-rc2   
[DEBUG] -- end configuration -- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE    
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.662s   
[INFO] Finished at: Tue Jan 08 14:02:33 CST 2013    
[INFO] Final Memory: 4M/81M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project myproject: Cannot deploy artifact from the local repository: /Users/davea/.m2/repository/org/directwebremoting/dwr/3.0.0-rc2/dwr-3.0.0-rc2.jar -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project myproject: Cannot deploy artifact from the local repository: /Users/davea/.m2/repository/org/directwebremoting/dwr/3.0.0-rc2/dwr-3.0.0-rc2.jar 
    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:39)    
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)    
    at java.lang.reflect.Method.invoke(Method.java:597) 
    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: Cannot deploy artifact from the local repository: /Users/davea/.m2/repository/org/directwebremoting/dwr/3.0.0-rc2/dwr-3.0.0-rc2.jar    
    at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:283)   
    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]     
[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

我的〜.m2 / settings.xml文件

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                  http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <profiles>
   <profile>
     <id>default</id>
     <repositories>
       <repository>
         <id>cloudbees-private</id>
         <name>Cloudbees private repo</name>
         <url>https://repository-myco.forge.cloudbees.com/private/</url>
       </repository>
     </repositories>
   </profile>
 </profiles>
 <activeProfiles>
   <activeProfile>default</activeProfile>
 </activeProfiles>

<servers>
    <server>
      <username>username</username>
      <password>password</password>
      <id>cloudbees-private</id>
    </server>
  </servers>

</settings> 

6 个答案:

答案 0 :(得分:8)

我不知道为什么,但是当您提供本地存储库中安装的工件路径时,deploy-file会出现该错误。 (更准确地说,当文件参数是工件在本地存储库中的确切位置时)。

http://grepcode.com/file/repo1.maven.org/maven2/org.apache.maven.plugins/maven-gpg-plugin/1.5/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java/#326

将工件文件(通常是jar)移动到其他地方并将此路径作为文件参数传递,解决了问题。

答案 1 :(得分:2)

从2.5版开始,deploy插件会检查要上传的文件是否驻留在本地存储库中,并且在这种情况下拒绝上传。您可以将插件的版本2.4指定为解决方法:

scripts.min.js

答案 2 :(得分:0)

嗯,我记得尝试将文件部署到我的Cloudbees存储库,它也无法正常工作。当时,我通过他们的论坛向Cloudbees询问了这个问题,其中一个支持人员为我部署了它。

他们确实有一些关于它的doco

http://wiki.cloudbees.com/bin/view/DEV/CloudBees+Private+Maven+Repository

我认为这更多是关于CLoudbees服务器如何接受请求,而不是你做错了什么。

答案 3 :(得分:0)

我只是在尝试将依赖项负载从一个私有存储库迁移到另一个私有存储库时碰到的。

我的解决方案是简单地建立到存储库位置的软链接(例如,使用ln -s),并通过该链接引用工件。

答案 4 :(得分:-1)

我建议改变你的做法。在本地下载并直接从下载的文件部署到存储库管理器,然后不要安装到本地存储库,而是作为第一个测试,看看它是否从repo管理器代理好。

这将通过添加测试以及为部署插件的限制提供解决方案来改善您的流程,并为您节省安装文件目标的执行。

我不确定为什么这个限制是插件的一部分,但我怀疑它与本地存储库中的组件的元数据有关,与存储库管理器相比。

答案 5 :(得分:-1)

需要wagon-webdav连接器。创建临时POM文件以提供该信息:

<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>dummy</groupId>
   <artifactId>dummy</artifactId>
   <version>1</version>
   <build>
      <extensions>
         <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-webdav</artifactId>
            <version>1.0-beta-2</version>
         </extension>
      </extensions>
   </build>
</project>