3

I'm starting a project which I want to compile with both Eclipse and Maven. On command line everything works fine and if I remove Maven nature the project runs OK in Eclipse. However with Maven enabled I get this error in first line of the POM

dependency=[com.actionbarsherlock:actionbarsherlock:apklib:4.2.0:compile] 
    not found in workspace

Here's my complete POM

<?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>
    <groupId>com.foo.bar</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>test</name>
    <properties>
        <java.version>1.6</java.version>
        <platform.version> 4.1.1.4</platform.version>
        <android.platform>16</android.platform>
        <android-support.version>r7</android-support.version>
        <abs-version>4.2.0</abs-version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>${android-support.version}</version>
        </dependency>
        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>actionbarsherlock</artifactId>
            <version>${abs-version}</version>
            <type>apklib</type>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>${android.platform}</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I also noticed that there's no link to ABS from Eclipse->Properties->Android->Library

What am I missing in this setup?

j0k
  • 22,600
  • 28
  • 79
  • 90
Bostone
  • 36,858
  • 39
  • 167
  • 227
  • 1
    You have to import and reference the actual library project in Eclipse as well, check out [this answer](http://stackoverflow.com/questions/8831481/apklib-does-not-get-installed-in-maven-repo/8831891#8831891) for more details. – yorkw Feb 20 '13 at 09:38

2 Answers2

2

Like you I compile with Maven and Eclipse, however I do not use the maven nature as it was too painful when I tried to use it.

Given that your error mentions ABS and that is a APKLIB which is kinda "faked" by Maven you might want ensure that this APKLIB is installed into your local maven repo. I dont believe that the maven nature supports workspace resolution but I could be wrong in this.

If that doesnt work you can always follow my example and just set eclipse up they default way which would mean turning off the maven nature and linking using Eclipse->Properties->Android->Library as you mentioned

Corey Scott
  • 2,430
  • 3
  • 28
  • 33
0

I was stuck with this and tried the following and it worked:

right click on project → maven → update project configuration → select all → enjoy!

redochka
  • 12,345
  • 14
  • 66
  • 79