Maven项目导入Eclipse后pom文件出错
我实际上是 Maven 框架的新手。我已经有一个 Maven 项目了。我从 http://m2eclipse.sonatype.org/sites/m2e。然后我导入了我的项目并启用了依赖项,但该项目显示了太多错误。 pom.xml 本身显示错误。错误
Project Build Error:unknown packaging:apk
Project Build Error:unresolvable build extension:plugin"
等。
我的错误区域是:
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nbc.cnbc.android</groupId>
<artifactId>android.domain.tests</artifactId>
<version>1.0.0</version>
<packaging>apk</packaging>
<parent>
<groupId>com.nbc.cnbc.android</groupId>
<artifactId>android.domain.parent</artifactId>
<version>1.0.0</version>
<relativePath>../android.domain.parent/pom.xml</relativePath>
</parent>
<name>android.domain.tests</name>
<url>http://maven.apache.org</url>
难道是因为最后一行中指定的 url 可能不同? 有什么想法为什么会发生这种情况吗? 任何回复都将受到高度赞赏。非常感谢!
I am actually new to the Maven framework. I already have a Maven project. I installed the Maven plugin etc into my EclipseIDE from http://m2eclipse.sonatype.org/sites/m2e. Then I imported my project and enabled dependencies, but the project is showing too many errors. The pom.xml itself is showing errors. The errors are
Project Build Error:unknown packaging:apk
Project Build Error:unresolvable build extension:plugin"
etc.
My error area is:
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nbc.cnbc.android</groupId>
<artifactId>android.domain.tests</artifactId>
<version>1.0.0</version>
<packaging>apk</packaging>
<parent>
<groupId>com.nbc.cnbc.android</groupId>
<artifactId>android.domain.parent</artifactId>
<version>1.0.0</version>
<relativePath>../android.domain.parent/pom.xml</relativePath>
</parent>
<name>android.domain.tests</name>
<url>http://maven.apache.org</url>
Could it be because the url specified in the last line could be different?
Any ideas why this could be happening?
Any reply is highly appreciated. Thanks a lot in advance!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您已经安装了适用于 Java 项目(和 .jar 文件)的“普通”Maven 插件。
对于 Android,您需要 Maven Android 插件
就我个人而言,我认为对于我在项目中使用的几个依赖项来说,Android Maven 太麻烦了,但这就是我尝试时的设置方式:
将 ANDROID_HOME 变量设置为您的 SDK 根位置并添加 SDK
tools
和platform-tools
文件夹添加到您的路径(更多信息请参阅 此链接)启动 Eclipse 并启用“依赖项” 启动 Eclipse 并在 Android项目
确保将 Maven Central 添加到您的存储库中并添加以下内容到你的pom(更多信息请参阅此链接或此链接)。
当然,您可以根据自己的喜好调整 Android 版本。
You have installed the "normal" Maven plugin that works for Java projects (and .jar files).
For Android you need the Maven Android Plugin
Personally, I think that Android Maven is too much of a hassle for the few dependencies that I use in my projects, but this is how I set it up when I tried it out:
Set the ANDROID_HOME variable to your SDK root location and add the SDK's
tools
andplatform-tools
folders to your path (more info see this link)Start Eclipse and enable "Dependency management" on your Android project.
Make sure you include Maven Central to you repositories and add the following to your pom (more info see this link or this link).
Off course you can adjust the android version to your liking.
最后更新:现在工件的名称似乎是 android-maven-plugin: http://mvnrepository.com/artifact/com.jayway.maven.plugins.android. Generation2/android-maven-plugin/3.6.0
所以它应该是这样的:
Last update: it seems that the name of the artifact is android-maven-plugin now: http://mvnrepository.com/artifact/com.jayway.maven.plugins.android.generation2/android-maven-plugin/3.6.0
So it should be like this: