如何告诉maven使用本地文件夹来解决zxing的Android项目的Local Dependency问题

时间:2015-01-27 13:42:23

标签: android maven zxing

我下载了zxing并尝试使用mvn在本地构建它。

我遇到了一些问题,当我尝试构建android项目(使其成为除apk文件以外的jar)时,我收到此错误:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------    ------
[INFO] Building Android Barcode Scanner app 4.7.1
[INFO] ------------------------------------------------------------------    ------
[WARNING] The POM for com.google.zxing:core:jar:3.1.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.google.zxing:android-core:jar:3.1.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.352 s
[INFO] Finished at: 2015-01-27T13:32:25+00:00
[INFO] Final Memory: 10M/36M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project android: Could not resolve dependencies for project com.google.zxing:android:jar:4.7.1: The following artifacts could not be resolved: com.google.zxing:core:jar:3.1.1-SNAPSHOT, com.google.zxing:android-core:jar:3.1.1-SNAPSHOT: Failure to find com.google.zxing:core:jar:3.1.1-SNAPSHOT in https://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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] 

我将android-core-3.1.1-SNAPSHOT.JAR和core-3.1.1-SNAPSHOT.JAR放入android项目的libs文件夹中,但它根本没用。

我做错了什么? android文件夹下的pom文件是

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <artifactId>android-core</artifactId>
  <version>3.1.1-SNAPSHOT</version>
  <packaging>jar</packaging>(i changed from apk to jar as I want to build it as a jar other than apk)

  <dependencies>
    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
    </dependency>
  </dependencies>

  <parent>
    <groupId>com.google.zxing</groupId>
    <artifactId>zxing-parent</artifactId>
    <version>3.1.1-SNAPSHOT</version>
  </parent>

  <name>ZXing Android Core</name>
  <description>Code common to Android applications</description>

</project>

1 个答案:

答案 0 :(得分:0)

这只是一个Maven问题。您已下载master的源代码,因此请指向SNAPSHOT版本。如果您确实想要使用它,则需要mvn install在本地创建快照工件。在这里,您直接进入android/并构建它,但这不起作用。只需从顶层构建所有内容即可。

https://github.com/zxing/zxing/wiki/Getting-Started-Developing对此进行了描述,但如果您要在master之外构建快照,则需要mvn install而不是mvn package