ActionBarSherlock + maven + eclipse: dependency not found in workspace
I've updated to lastest version of ADT Plugin and I faced this issue, solved updating also m2e-android eclipse plugin. Now, I'm able to compile my project through console, but not with eclipse. This is the exception thrown by pom.xml
file in eclipse:
dependency=[com.actionbarsherlock:library:apklib:4.1.0:compile] not found in workspace
In previous versions of ADT/m2e-android, I was able to build both console and eclipse without problems.
Does anyone know how to solve this? Maybe my pom.xml is wrong?
Thanks for your time.
Currently using:
pom.xml:
<?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.jelies</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<dependencies>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.1_r2</version>
<scope>provided</scope>
</dependency>
<!-- some unrelated dependencies -->
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>4.1.0</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<sdk>
<platform>16</platform>
</sdk>
<emulator>
<avd>avd-4.1</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>eclipse</id>
<activation>
<!-- This profile is only activated when m2e.version is present (only
in eclipse) -->
<property>
<name>m2e.version</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r7</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
EDIT:
Answer is right. Having ABS library project mavenized in my workspace, error is gone! But, another problem appeared: ABS transitive dependencies are added to my project, causing eclipse to be not able to launch the application. This is a known issue you can follow here.
As of Android 0.4.2 you now need to mavenise the Android library projects in your Eclipse workspace for m2e-android to successfully detect them. The POM for ActionBarSherlock can be found here:
https://github.com/JakeWharton/ActionBarSherlock/blob/master/library/pom.xml#
Note: m2e-android is beta software and so changes that might affect functionality can occur between releases.
For those who don't know what "MAVENIZED" means it is convert a simple project to be a Maven Project.
In Eclipse, right click in your project, Configure -> Convert to Maven Project
you can include the actionbarsherlock dependency as jar file only when using eclipse via profiles
<profile>
<id>m2e</id>
<activation>
<property><name>m2e.version</name></property>
</activation>
<dependencies>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>${abs.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</profile>
and don't need to include the entire actionbarsherlock as project in eclipse
链接地址: http://www.djcxy.com/p/87276.html上一篇: 无法将Maven导入Eclipse