granan
granan

Reputation: 341

How to set up correctly actionbarsherlock dependencies in maven?

I’m new maven user. I want to build my android application which consists of roboguice and actionbarsherlock dependence. My problem is actionbarsherlock dependence. I include it by

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

    <!-- Let Roboguice and Sherlock work together -->
    <dependency>
        <groupId>com.github.rtyley</groupId>
        <artifactId>roboguice-sherlock</artifactId>
        <version>1.4</version>
    </dependency>

in module pom.xml file, but my editor cannot import actionbarsherlock view classes. In package explorer in maven dependenceies there isn't any actionbarsherlock jar, but missed files are in target/unpack/apklibs/com.actionbarsherlock_actionbarsherlock_apklib_4.2.0/src/com/actionbarsherlock/view

How to set up correctly actionbarsherlock dependency ???

My development IDE is eclipse. I have installed m2e, android configuration for m2e in eclipse, and can import android maven project.

My project has 2 modules: application and facebook sdk. I set up android version to 15.

In pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>application</artifactId>
<name>Grand</name>
<packaging>apk</packaging>

<parent>
    <groupId>pl.grand</groupId>
    <artifactId>Grand</artifactId>
    <version>1.0.0</version>
    <relativePath>../pom.xml</relativePath>
</parent>

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.roboguice</groupId>
        <artifactId>roboguice</artifactId>
        <version>2.0</version>
    </dependency>

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

    <!-- Let Roboguice and Sherlock work together -->
    <dependency>
        <groupId>com.github.rtyley</groupId>
        <artifactId>roboguice-sherlock</artifactId>
        <version>1.4</version>
    </dependency>

    <!-- facebook sdk -->
    <dependency>
        <groupId>com.facebook.android</groupId>
        <artifactId>facebook-android-sdk</artifactId>
        <version>1.0.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <sdk>
                    <platform>15</platform>
                </sdk>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin> 
    </plugins>
</build>

Upvotes: 3

Views: 2830

Answers (1)

Roberto Andrade
Roberto Andrade

Reputation: 1853

I've been caught by that a few times, you gotta actually add both the APKLIB and JAR dependencies to your project (where the APKLIb brings the resources and all that is part of the Android Library project) and the JAR brings the compiled classes.

In effect:

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

<dependency>
    <groupId>com.actionbarsherlock</groupId>
    <artifactId>actionbarsherlock</artifactId>
    <version>4.2.0</version>
    <type>jar</type>
</dependency>

Upvotes: 4

Related Questions