Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"compatibility-v4-r4.jar" is missing in Maven Repo

In the last two days I tried to import this Library through Maven:

https://github.com/JakeWharton/Android-ViewPagerIndicator

I have to say that I'm new to maven so if this is easy to solve please forgive me I googled the problem and studied the error pages but I could not find a solution for this problem. But everytime I try i get an error like that:

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

Throug my Issues Post on github I got the Info that I have to change the compat depencies from r4 to r6 in the pom.xml and so I tried it and changed it from:

<android.support.version>r4</android.support.version>

to this:

<android.support.version>r6</android.support.version>

But this didnt work and so I moved on and tried it that way. I edited the Depencies section from this:

            <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4</artifactId>
            <version>${android.support.version}</version>
        </dependency>

to this:

            <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4-r6</artifactId>
            <version>${android.support.version}</version>
        </dependency>

and I also tried to replace "compatibility-v4" with:

compatibility-v6 and compatibility-r6

but nothing worked. I also checked the .m2 directory and it is not there. I also recked if Maven is installed proberly and it is. I hope somebody can help me.

Best Regards

like image 992
Aragok Avatar asked Dec 22 '11 19:12

Aragok


2 Answers

The support library is now available in a public maven repository, thanks to Manfred and Jake

http://www.simpligility.com/2012/01/android-compatibility-library-following-lint/

You just need to use a slightly different dependency specification

<dependency>
  <groupId>com.google.android</groupId>
  <artifactId>support-v4</artifactId>
  <version>r6</version>
</dependency>
like image 65
emmby Avatar answered Nov 14 '22 23:11

emmby


The way how maven works is quite straightforward, download the required jar dependencies from internet to your local maven repository first, when building your application later, it resolve all required jar files from your local maven repository here.

Your problem:
Maven is trying to download a jar file from http://r.jakewharton.com/maven/release/android/support/compatibility-v4/r4/, try it yourself, this is a dead link. this usually means the developer doesn't maintain their maven release properly.

The sulotion:
I suppose this post on GitHub is from you, you need to use maven-android-sdk-deployer, check out the "How to Use" section here. basically, you need run maven-android-sdk-deployer to copy the required jars (which are not available through internet yet) from your local Android SDK directory into your maven local repository, as I said, If you don't specify it explicitly, maven always resolve jar files from your local maven repository.

like image 34
yorkw Avatar answered Nov 14 '22 22:11

yorkw