在过去的两天里,我尝试通过Maven导入这个库:
https://github.com/JakeWharton/Android-ViewPagerIndicator
我不得不说我是maven的新手所以如果这很容易解决请原谅 我用Google搜索了问题并研究了错误页面,但我找不到 这个问题的解决方案。 但每次我尝试我都会得到这样的错误:
c:\JakeWharton-Android-ViewPagerIndicator-3db7585>mvn install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.viewpagerindicator:library:apklib:2.2.0
[WARNING] 'build.plugins.plugin.version' for com.jayway.maven.plugins.android.ge
neration2:maven-android-plugin is missing. @ line 36, column 12
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.viewpagerindicator:sample:apk:2.2.0
[WARNING] 'build.plugins.plugin.version' for com.jayway.maven.plugins.android.ge
neration2:maven-android-plugin is missing. @ line 48, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Android-ViewPagerIndicator (Parent)
[INFO] Android-ViewPagerIndicator
[INFO] Android-ViewPagerIndicator Sample
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Android-ViewPagerIndicator (Parent) 2.2.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ parent ---
[INFO] Installing c:\JakeWharton-Android-ViewPagerIndicator-3db7585\pom.xml to C
:\Users\Cracksoldier\.m2\repository\com\viewpagerindicator\parent\2.2.0\parent-2
.2.0.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Android-ViewPagerIndicator 2.2.0
[INFO] ------------------------------------------------------------------------
Downloading: http://r.jakewharton.com/maven/release/android/support/compatibilit
y-v4/r4/compatibility-v4-r4.pom
Downloading: http://repo1.maven.org/maven2/android/support/compatibility-v4/r4/c
ompatibility-v4-r4.pom
[WARNING] The POM for android.support:compatibility-v4:jar:r4 is missing, no dep
endency information available
Downloading: http://r.jakewharton.com/maven/release/android/support/compatibilit
y-v4/r4/compatibility-v4-r4.jar
Downloading: http://repo1.maven.org/maven2/android/support/compatibility-v4/r4/c
ompatibility-v4-r4.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Android-ViewPagerIndicator (Parent) ............... SUCCESS [0.204s]
[INFO] Android-ViewPagerIndicator ........................ FAILURE [1.636s]
[INFO] Android-ViewPagerIndicator Sample ................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.953s
[INFO] Finished at: Thu Dec 22 18:29:20 CET 2011
[INFO] Final Memory: 10M/108M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project library: Could not resolve dependencie
s for project com.viewpagerindicator:library:apklib:2.2.0: Could not find artifa
ct android.support:compatibility-v4:jar:r4 in com.jakewharton (http://r.jakewhar
ton.com/maven/release) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :library
通过github发布我的问题我得到了Info,我必须更改compat pom.xml中从r4到r6的依赖关系,所以我尝试了它并将其改为:
<android.support.version>r4</android.support.version>
到此:
<android.support.version>r6</android.support.version>
但是这没有用,所以我继续前进并尝试了这种方式。 我从这里编辑了Depencies部分:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<version>${android.support.version}</version>
</dependency>
到此:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4-r6</artifactId>
<version>${android.support.version}</version>
</dependency>
我还尝试将“compatibility-v4”替换为:
compatibility-v6和 兼容性-R6
但没有任何效果。我还检查了.m2目录,它不存在。 如果Maven安装得很好,我也会进行修复。 我希望有人可以帮助我。
最好的问候
答案 0 :(得分:10)
由于Manfred和Jake
,支持库现在可以在公共maven存储库中使用http://www.simpligility.com/2012/01/android-compatibility-library-following-lint/
您只需要使用稍微不同的依赖规范
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r6</version>
</dependency>
答案 1 :(得分:3)
maven的工作方式非常简单,首先将所需的jar依赖项从Internet下载到本地maven存储库,在以后构建应用程序时,它会从本地maven存储库中解析所有必需的jar文件。
你的问题:
Maven正试图从http://r.jakewharton.com/maven/release/android/support/compatibility-v4/r4/下载一个jar文件,自己试试,这是一个死链接。这通常意味着开发人员不能正确维护他们的maven版本。