2013-02-21 30 views
2

我有一個不是用maven構建的android lib(定製的,集成的zxing條形碼掃描器庫)。所以我嘗試使用mvn install:install-file來創建apklib到我的本地maven倉庫。爲非maven Android庫項目創建apklib失敗

所以我跑:

mvn install:install-file -Dfile=zxing-integrated-1.0.apklib \ 
         -DgroupId=com.google.zxing \ 
         -DartifactId=zxing-integrated \ 
         -Dversion=1.0 \ 
         -Dpackaging=apklib \ 
         -DgeneratePom=true \ 
         -DcreateChecksum=true 

這回在命令行上執行以下操作:

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom --- 
[INFO] Installing /Users/myuser/Projects/myproject/zxing/zxing-integrated-1.0.apklib to /Users/myuser/.m2/repository/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.apklib 
[INFO] Installing /var/folders/s0/0qcqwh696150dhq_lb0l3pd80000gn/T/mvninstall735817733736670848.pom to /Users/myuser/.m2/repository/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.488s 
[INFO] Finished at: Thu Feb 21 11:27:23 CST 2013 
[INFO] Final Memory: 7M/94M 
[INFO] ------------------------------------------------------------------------ 

沒有apklib文件被創建在Maven回購。我得到的有:

enter image description here

所以我在想,什麼是錯的上面安裝文件的命令。這是lib項目的項目結構,我正在嘗試構建apklib。 它遵循正規的Android項目結構(不是Android的Maven項目結構,我假設是做正確的方式?)

enter image description here

當我運行MVN安裝我的主要項目,該項目的POM。 XML包括:

<dependency> 
     <groupId>com.google.zxing</groupId> 
     <artifactId>zxing-integrated</artifactId> 
     <version>1.0</version> 
     <type>apklib</type> 
    </dependency> 

我越來越:

> mvn install 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building com.myproject.subname.android 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.jar 
Downloading: http://repo1.maven.org/maven2/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.jar 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 10.128s 
[INFO] Finished at: Thu Feb 21 11:13:20 CST 2013 
[INFO] Final Memory: 11M/137M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal on project com.myproject.subname.android: Could not resolve dependencies for project com.myproject:com.myproject.subname.android:apk:1.0-SNAPSHOT: Could not find artifact com.google.zxing:zxing-integrated:jar:1.0 in snapshots-repository (https://oss.sonatype.org/content/repositories/snapshots) -> [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/DependencyResolutionException 

回答

3

Maven的安裝文件的目標只是一個上傳現有文件傳輸到本地存儲庫。它不創建文件。您必須有一個現有文件zxing-integrated-1.0.apklib,以便您可以使用該命令上傳它。

+0

嗯,我想我應該仔細閱讀文檔。感謝您指出了這一點。現在沒事了。 – 2013-02-21 07:40:28