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

倖福魔咒の 提交于 2019-12-10 19:55:27

问题


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.


回答1:


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)



来源:https://stackoverflow.com/questions/18355196/maven-eclipse-plugin-wont-add-android-support-v4-to-build-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!