Maven的Eclipse插件不会增加支持Android-V4到构建路径 [英] Maven Eclipse Plugin won't add Android support-v4 to build path
问题描述
我正在使用RoboGuice与Eclipse ADT,M2E以及Android的Maven的插件项目。
I'm working on a project using RoboGuice with Eclipse ADT, m2e and android-maven-plugin.
我使用RoboListFragment类取决于android.support.v4.app.ListFragment,为此我已经添加下面的依赖关系的pom.xml
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:
的类型android.support.v4.app.Fragment不能得到解决。这是间接需要的.class文件中引用的
我发现的唯一的解决方法是将其添加到构建路径作为一个外部JAR,但随后的.classpath指的是我自己的主目录。
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.
推荐答案
尝试删除
<scope>provided</scope>
在Maven的,这意味着支持-V4将在类路径(见<一href=\"http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope\" rel=\"nofollow\">http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_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)
这篇关于Maven的Eclipse插件不会增加支持Android-V4到构建路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!