2012-06-13 89 views
8

我想让安装程序在Eclipse中为我的Android项目使用Maven和pom.xml文件。我有Eclipse Indigo设置(包括m2e),安装了Android SDK,安装了ADT。我很努力地理解“安装m2e-android-plugin”的含义(我总是被带到,它提供了关于安装它的说明,但我无法遵循)具体来说,当我浏览该页面上的指令时,之后我完成第2部分中的所有步骤,我的结构不具有“Maven依赖”和我的pom.xml文件显示以下错误:上线如何在Eclipse中安装m2e-android-plugin?

Project build error: Unknown packaging: apk 

Project build error: Unresolveable build extension: Plugin 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1 or one of its dependencies could 
not be resolved: The following artifacts could not be resolved: 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1, 
com.android.ddmlib:ddmlib:jar:r16, org.sonatype.sisu:sisu-inject-bean:jar:2.1.1,  
org.sonatype.sisu:sisu-guice:jar:no_aop:2.9.4, org.codehaus.plexus:plexus- archiver:jar:2.0.1, junit:junit:jar:3.8.1, 
org.codehaus.plexus:plexus-io:jar:2.0.1, org.codehaus.plexus:plexus-utils:jar:3.0, commons-jxpath:commons- 
jxpath:jar:1.3, commons-io:commons-io:jar:2.0.1, org.ow2.asm:asm:jar:4.0, commons-lang:commons-lang:jar: 
2.6, org.sonatype.aether:aether-util:jar:1.12: Failure to transfer 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1 from http://repo1.maven.org/ 
maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central 
has elapsed or updates are forced. Original error: Could not transfer artifact 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1 from/to central (http:// 
repo1.maven.org/maven2): No response received after 60000 

沿

<packaging>apk</packaging> 

回答

8

我试图建立一个新的第二个IDE自己,一切都会按预期的,假设你已经安装了Android SDK和Maven的正确(最好使用最新版本),这些都是Maven化的Android项目工作所需要的仅仅是Eclipse插件:

  • ADT
  • M2E
  • M2E-的Android

看看我的截图Help -> Install New Software... -> what is already installed

enter image description here

如果按照从this page开始一个新项目的说明中,<包装>错误很可能是由于行家释放小插件earlie版本(如果你没有明确指定一个)。通过<包装>在pom.xml的元素上悬停鼠标,你应该得到一些提示,如:

maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.

下<插件>添加以下插件:

<plugin> 
    <artifactId>maven-resources-plugin</artifactId> 
    <version>2.5</version> 
</plugin> 

新的项目,然后用鼠标右键单击并选择Maven - >更新项目配置,这应该修复所有的错误,并给你一个工作的例子。

+0

我尝试过Eclipse Marketplace。当我单击安装时,我会收到以下消息:“以下解决方案不可用:M2E的Android配置器继续进行安装?” – Leo

+0

是的,我看到了(从未显示过)。进行是的。 – yorkw

+0

是啊,看起来它没有实际安装它,因此东西仍然不起作用... – Leo

1

我必须要安装在eclipse JUNO了Android M2E同样的问题。 然后尝试通过“安装新软件”向导安装,而不是市场。

从上市软件添加如下的更新站点,选择“Android的Maven的月食”并安装。

http://rgladwell.github.com/m2e-android/updates - 由于@NullNoname提供更新站点。

+1

该链接不适合我。我收到这样的信息:_这里没有GitHub页面。你能否修复这个链接? – honk