在过去的两天里,我尝试通过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>但这并不管用,所以我继续往前走,并尝试了这种方式。我从下面编辑了依赖项部分:
<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是否已正确安装,确实如此。我希望有人能帮助我。
诚挚的问候
发布于 2011-12-23 04:51:04
maven的工作方式非常简单,首先从internet下载所需的jar依赖项到本地maven存储库,稍后构建应用程序时,它会解析本地maven存储库中所有必需的jar文件。
你的问题:
Maven正在尝试从http://r.jakewharton.com/maven/release/android/support/compatibility-v4/r4/下载jar文件,请自己尝试,这是一个死链接。这通常意味着开发人员没有正确地维护他们的maven发行版。
解决方案:
我假设GitHub上的this post来自你,你需要使用maven-android-sdk-deployer,请查看这里的“如何使用”部分。基本上,你需要运行maven- Android - SDK -deployer从你本地的Android SDK目录复制所需的jar文件到maven本地仓库,就像我说的,如果你没有明确指定,maven总是会解析来自你本地maven仓库的jar文件。
发布于 2012-03-16 03:06:14
多亏了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>https://stackoverflow.com/questions/8608971
复制相似问题