这两天尝试通过Maven导入这个库:
https://github.com/JakeWharton/Android-ViewPagerIndicator
我不得不说我是maven的新手所以如果这很容易解决请原谅 我用谷歌搜索了这个问题并研究了错误页面,但我找不到 这个问题的解决方案。 但是每次我尝试都会遇到这样的错误:
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 上发布的问题,我得到了我必须更改兼容性的信息 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”替换为:
兼容性-v6 和 兼容性-r6
但没有任何效果。我还检查了 .m2 目录,但它不在那里。 我还检查了是否正确安装了 Maven,确实如此。 我希望有人能帮助我。
最好的问候
最佳答案
感谢 Manfred 和 Jake,支持库现在可以在公共(public) 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>
关于android - Maven Repo 中缺少 "compatibility-v4-r4.jar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8608971/