Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APKLIB does not get installed in Maven Repo

This must be a very stupid newbie question, but I have spent my whole day trying to figure out what is wrong with this thing.

I was about to include a dependency on Sherlock Action bar into my Android-Maven project. The site made a repo to support maven-android setup. I know that I was supposed to just include the dependency, then specify the repo inside the pom, that I have managed to do, but to no luck did this just not work for me.

these are the dependency and repository tags I used

    <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>library</artifactId>
        <version>3.5.1</version>
        <type>apklib</type>
    </dependency>

and this

    <repository>
        <id>jakewharton</id>
        <url>http://r.jakewharton.com/maven/release/</url>
    </repository>

i don't have any errors at all. It's just that I can't see the APKLIB under the maven dependencies directory on my package explorer at eclipse. But most importantly, I can't use the packages/classes under the apklib.

Am I missing anything?

like image 310
mahkie Avatar asked Jan 12 '12 07:01

mahkie


1 Answers

This special type of apklib dependency only works in android-maven-plugin from command line console. adding it as a dependency in your main project's POM does not automatically import the library project into your Eclipse, so no library project shown in Package Explorer.

Simply adding the apklib as a dependency in pom doesn't help much for project development. as packages/classes under the apklib is not referenced/linked to your main project. it is different from the regular jar dependency, where you simply add jar dependency into your project and start import/use packages/classes in your main project.

Your need import the library project into your Eclipse workspace, and link it with your main project. As you already use android-maven-plugin, the most straight forward way to do this is change your maven project into multi-module project and add the library project as a sub-module check out the LibraryProjects from android-maven-plugin sample here

Hope this help.

like image 79
yorkw Avatar answered Nov 02 '22 11:11

yorkw