Maven Eclipse Plugin won’t add Android support-v4 to build path

I’m working on a project using RoboGuice with Eclipse ADT, m2e and android-maven-plugin.

I’m using RoboListFragment class which depends on android.support.v4.app.ListFragment, for this reason I’ve added the following dependency to pom.xml

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>support-v4</artifactId>
    <version>r7</version>
    <scope>provided</scope>
</dependency>

Nevertheless eclipse does not add that library to build path. When I build my project from command line everything is ok, but in eclipse I get this error message:

The type android.support.v4.app.Fragment cannot be resolved. It is indirectly referenced from required .class files

The only workaround I found is adding it to the build path as an external jar, but then .classpath refers to my own home directory.

Answer

Try to remove

<scope>provided</scope>

In Maven, this means support-v4 will be in the classpath (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope)

Source: stackoverflow
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .