【问题标题】:Creating apklib for non-maven Android library project fails为非 Maven Android 库项目创建 apklib 失败
【发布时间】:2013-02-06 10:36:36
【问题描述】:

我有一个不是用 maven 构建的 android 库(定制的、集成的 zxing 条码扫描器库)。所以我尝试使用 mvn install:install-file 将 apklib 创建到我的本地 maven 存储库。

所以我跑了:

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] ------------------------------------------------------------------------

没有在 maven 存储库中创建 apklib 文件。我得到的只是:

所以我想知道,上面的 install-file 命令有什么问题。这是 lib 项目的项目结构,我正在尝试为其构建 apklib。 它遵循常规的 Android 项目结构(不是 Android Maven 项目结构,我认为这是正确的做法?)

当我运行我的主项目的 mvn install 时,其中 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

【问题讨论】:

    标签: android maven apklib


    【解决方案1】:

    maven install-file 目标只是将现有文件上传到本地存储库。它不创建文件。您必须有一个现有的文件zxing-integrated-1.0.apklib,以便您可以使用命令上传它。

    【讨论】:

    • 好吧,我想我应该更仔细地阅读文档。感谢您指出了这一点。现在好了。
    猜你喜欢
    • 2012-12-02
    • 1970-01-01
    • 1970-01-01
    • 2014-10-10
    • 1970-01-01
    • 1970-01-01
    • 2015-05-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多