你如何在 Eclipse 中安装 m2e-android-plugin?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11023252/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you install m2e-android-plugin in Eclipse?
提问by Leo
I am trying to get setup to use Maven and pom.xml files in Eclipse for my Android projects. I have Eclipse Indigo setup (m2e included), Android SDK installed, ADT installed. I am struggling to understand what it means to "Install the m2e-android-plugin" (I am always taken to this pagewhich provides instructions on installing it, but which I cannot follow) Specifically, when I go through the instruction on that page, after I complete all the steps in part 2, my structure does not have "Maven Dependencies" and my pom.xml file shows the following error:
我正在尝试设置以在 Eclipse 中为我的 Android 项目使用 Maven 和 pom.xml 文件。我有 Eclipse Indigo 设置(包括 m2e),安装了 Android SDK,安装了 ADT。我很难理解“安装 m2e-android-plugin”是什么意思(我总是被带到这个页面,它提供了安装它的说明,但我无法遵循)具体来说,当我浏览该页面上的说明时,在我完成第 2 部分中的所有步骤后,我的结构没有“Maven 依赖项”并且我的 pom.xml 文件显示以下错误:
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
along with:
随着:
Project build error: Unknown packaging: apk
on the line
在线上
<packaging>apk</packaging>
采纳答案by yorkw
I have tried set up a fresh second IDE myself and everything works as expected, suppose you have installed both Android SDK and Maven properly (better to use latest version), these are the only Eclipse plugins required to work with Mavenized Android Project:
我已经尝试自己设置一个新的第二个 IDE,一切都按预期工作,假设您已经正确安装了 Android SDK 和 Maven(最好使用最新版本),这些是与 Mavenized Android 项目一起工作所需的唯一 Eclipse 插件:
- adt
- m2e
- m2e-android
- 广告
- m2e
- m2e-android
Check out my screenshot Help -> Install New Software... -> what is already installed
:
看看我的截图Help -> Install New Software... -> what is already installed
:
If you follow instructions from this pagestarting with a new project, the <packaging> error is most likely due to earlie version of maven-release-plugin (if you do not explicitly specify one). By hovering mouse on <packaging> element in pom.xml, you should get some hint like:
如果您按照此页面的说明从新项目开始,<packaging> 错误很可能是由于 maven-release-plugin 的早期版本(如果您没有明确指定)。通过将鼠标悬停在 pom.xml 中的 <packaging> 元素上,您应该会得到一些提示,例如:
maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.
m2e 不支持 2.4 之前的 maven-resources-plugin。使用 maven-resources-plugin 2.4 或更高版本。
Adding the following plugin under <plugins>:
在 <plugins> 下添加以下插件:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</plugin>
Then Right-click on new project and select Maven -> Update Project Configuration, this should fix all error and give you a working example.
然后右键单击新项目并选择 Maven -> 更新项目配置,这应该修复所有错误并为您提供一个工作示例。
回答by ArizonSolutions
I had the same problem trying to install the android m2e in eclipse JUNO. Then tried to install through "Install new software" wizard, instead of market place.
我在尝试在 eclipse JUNO 中安装 android m2e 时遇到了同样的问题。然后尝试通过“安装新软件”向导而不是市场进行安装。
Add the following as an update site and select "Android For Maven eclipse" from the listed softwares and install.
添加以下作为更新站点并从列出的软件中选择“Android For Maven eclipse”并安装。
http://rgladwell.github.com/m2e-android/updates- Thanks to @NullNoname for providing the update site.
http://rgladwell.github.com/m2e-android/updates- 感谢@NullNoname 提供更新站点。