2012-02-18 58 views
12

我正在設置一個Jenkins構建環境來構建我的android項目。但大多數情況下,它的確定存在一些中央資源庫中不可用的依賴項,例如Google Android Maps API,因此我需要手動將其安裝到我的遠程存儲庫。我已經使用mvn install將這些安裝到本地回購,並且工作正常。無法安裝本地maven artefact到遠程存儲庫,google-android-maps

我已經完成了一些Google搜索,並且具有以下配置,但是當我嘗試將地圖jar部署到遠程倉庫時,出現以下錯誤。

mvn deploy:deploy-file -DgroupId=com.google.android.maps -DartifactId=maps -Dversion=8_r1 -Dpackaging=jar -Dfile=C:\Users\James\.m2\repository\com\google\android\maps\maps\8_r1\maps-8_r1.jar -DrepositoryId=cloudbeesreleases -Durl=https://repository-myusername.forge.cloudbees.com/release/ 

,我看到:

[INFO] Error stacktraces are turned on. 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-deploy-plugin:2.5:deploy-file (default-cli) @ standalone-pom --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.450s 
[INFO] Finished at: Sat Feb 18 17:01:06 GMT 2012 
[INFO] Final Memory: 4M/92M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project standalone-pom: Cannot deploy artifact from the local repository: C:\Users\James\.m2\repository\com\google\android\maps\maps\8_r1\maps-8_r1.jar -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project standalone-pom: Cannot deploy artifact from the local repository: C:\Users\James\.m2\repository\com\google\android\maps\maps\8_r1\maps-8_r1.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:319) 
    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: C:\Users\James\.m2\repository\com\google\android\maps\maps\8_r1\maps-8_r1.jar 
    at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:211) 
    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 

我有下面的我settings.xml

<profiles> 
    <profile> 
     <id>artifactory</id> 
     <repositories> 
     <repository> 
      <id>cloudbeesreleases</id> 
      <name>libs-releases</name> 
      <url>https://repository-myusername.forge.cloudbees.com/release/</url> 
      <snapshots> 
      <enabled>false</enabled> 
      </snapshots> 
     </repository>   
     </repositories>  
    </profile> 
    </profiles> 
    <activeProfiles> 
    <activeProfile>artifactory</activeProfile> 
    </activeProfiles> 

有我有什麼錯誤配置,還是我完全誤解怎麼deploy應該工作?

回答

0

需要嘗試的幾件事: 使用settings參數確保正在使用正確的設置文件,其中有多個文件具有層次結構。

--settings <arg> 

是否日誌輸出說有點像上傳http:// .....是URL正確,你會期望它是什麼?

使用sonatype前端手動上傳他們的選項?

不該你的設置文件也有一個服務器標籤:

<server> 
    <id>deploymentRepo</id> 
    <username>repouser</username> 
    <password>repopwd</password> 
</server> 

docs說「服務器ID對下圖settings.xml中的部分」,所以我猜測它會不會沒有工作匹配服務器配置。

9

錯誤消息看起來很簡單。

無法部署從本地資源庫神器:...

你可以嘗試部署文件,將其放置在不同的位置?另外this discussion似乎是在同一問題,並說明爲什麼有問題。

+6

我有同樣的問題,所以我將工件複製到/ tmp /並嘗試從該位置進行部署。有效! – neu242 2014-05-05 10:41:00

+0

謝謝,複製Maven本地回購之外的文件解決了問題! – Laimoncijus 2015-01-09 13:54:10

+0

如果有一種方法可以覆蓋這種行爲(例如--force),那將會很好,因爲存在多種場景,其中用戶實際上可能需要這樣做......必須將文件從存儲庫中複製出來一種黑客。 – James 2016-07-11 17:59:02

相關問題