简体   繁体   English

Maven Eclipse插件不会添加Android support-v4来构建路径

[英]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. 我正在使用RoboGuice与Eclipse ADT,m2e和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 我正在使用RoboListFragment类,它取决于android.support.v4.app.ListFragment,因此我在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. 然而,eclipse并没有添加该库来构建路径。 When I build my project from command line everything is ok, but in eclipse I get this error message: 当我从命令行构建我的项目时一切正常,但在eclipse中我收到此错误消息:

The type android.support.v4.app.Fragment cannot be resolved. android.support.v4.app.Fragment类型无法解析。 It is indirectly referenced from required .class files 它是从所需的.class文件间接引用的

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. 我找到的唯一解决方法是将它作为外部jar添加到构建路径,但是.classpath指的是我自己的主目录。

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 ) 在Maven中,这意味着support-v4将在类路径中(参见http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM