通过在Eclipse Market上下载的Maven插件,在使用时发现会对
<executions>
<execution>
这样的表情报错误,原因是Maven插件的问题。现将解决方案做个简单的说明:
1.删除原来的Maven插件,在线安装新的插件:
name:m2eclipse
location:http://download.eclipse.org/technology/m2e/releases (最新可用地址)
(失效地址:http://m2eclipse.sonatype.org/sites/m2e)
2.安装时可能会提示需要安装依赖插件,估计是这个:
name:GEF
location: http://download.eclipse.org/tools/gef/updates/releases/
安装maven插件时遇到了如下的错误:
Cannot complete the install because one or more required items could not be found.
Software being installed: Maven Integration for Eclipse (Required) 0.12.1.20110112-1712 (org.maven.ide.eclipse.feature.feature.group 0.12.1.20110112-1712)
Missing requirement: Maven Integration for Eclipse (Editors) 0.12.1.20110112-1712 (org.maven.ide.eclipse.editor 0.12.1.20110112-1712) requires 'bundle org.eclipse.zest.core 0.0.0' but it could not be found
Cannot satisfy dependency:
From: Maven Integration for Eclipse (Required) 0.12.1.20110112-1712 (org.maven.ide.eclipse.feature.feature.group 0.12.1.20110112-1712)
To: org.maven.ide.eclipse.editor [0.12.1.20110112-1712]
最终插件安装地址截图:
3.重启Eclipse提示需要JDK,而不是JRE:
根据提示是要设置 -vm 参数,打开Eclipse.ini配置:
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
C:\Program Files\Java\jdk1.6.0_10\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm 参数根据实际安装路径设置。
2013-7-9重新安装m2e插件遇到的问题:
1.原资源地址失效,现在新的是:
name:m2eclipse
location:http://download.eclipse.org/technology/m2e/releases
2.安装时遇到的不可解决依赖为题:Cannot complete the install because one or more required items could not be found.
Software being installed: m2e - slf4j over logback logging (Optional) 1.4.0.20130601-0317 (org.eclipse.m2e.logback.feature.feature.group 1.4.0.20130601-0317)
Missing requirement: async-http-client 1.6.5.20130531-2315 (com.ning.async-http-client 1.6.5.20130531-2315) requires 'package org.slf4j 1.6.2' but it could not be found
Cannot satisfy dependency:
From: Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.core 1.4.0.20130601-0317)
To: bundle com.ning.async-http-client [1.6.5,1.6.6)
Cannot satisfy dependency:
From: Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.core.ui 1.4.0.20130601-0317)
To: bundle org.eclipse.m2e.core [1.4.0,1.5.0)
Cannot satisfy dependency:
From: m2e logback appender 1.4.0.20130601-0317 (org.eclipse.m2e.logback.appender 1.4.0.20130601-0317)
To: bundle org.eclipse.m2e.core.ui [1.4.0,1.5.0)
Cannot satisfy dependency:
From: m2e - slf4j over logback logging (Optional) 1.4.0.20130601-0317 (org.eclipse.m2e.logback.feature.feature.group 1.4.0.20130601-0317)
To: org.eclipse.m2e.logback.appender [1.4.0.20130601-0317]
解决方法,此时先下载GEF
name:GEF
location: http://download.eclipse.org/tools/gef/updates/releases/
如果在下载Gef时出现:Duplicate location 错误,把Eclipse里含有http://download.eclipse.org/tools/gef/updates/releases/ 项的地方删除,并重新下载(以前为disable)。3.重复步骤1,下载 m2eclipse
此时以为会成功,但是依然报错:
Cannot complete the install because one or more required items could not be found.
Software being installed: m2e - slf4j over logback logging (Optional) 1.4.0.20130601-0317 (org.eclipse.m2e.logback.feature.feature.group 1.4.0.20130601-0317)
Missing requirement: async-http-client 1.6.5.20130531-2315 (com.ning.async-http-client 1.6.5.20130531-2315) requires 'package org.slf4j 1.6.2' but it could not be found
Cannot satisfy dependency:
From: Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.core 1.4.0.20130601-0317)
To: bundle com.ning.async-http-client [1.6.5,1.6.6)
Cannot satisfy dependency:
From: Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.core.ui 1.4.0.20130601-0317)
To: bundle org.eclipse.m2e.core [1.4.0,1.5.0)
Cannot satisfy dependency:
From: m2e logback appender 1.4.0.20130601-0317 (org.eclipse.m2e.logback.appender 1.4.0.20130601-0317)
To: bundle org.eclipse.m2e.core.ui [1.4.0,1.5.0)
Cannot satisfy dependency:
From: m2e - slf4j over logback logging (Optional) 1.4.0.20130601-0317 (org.eclipse.m2e.logback.feature.feature.group 1.4.0.20130601-0317)
To: org.eclipse.m2e.logback.appender [1.4.0.20130601-0317]
说明和Gef关系不大,仔细看上面的分析,是缺少slf4j依赖。
从这个帖子里的说明是:
missing "org.slf4j.api_1.4.0.v20130601-0317.jar", so you need copy the file to eclipse/plugins!
我试着把一个org.slf4j.api修改成上面这个名字然后再扔到eclipse下的plugins目录里,重新下载,发现错误依然。此时我怀疑是源资源的问题,所以不再使用在线资源,而去网上寻找m2e差件包。
插件包地址:http://download.csdn.net/download/defonds/4487410
教程:http://blog.csdn.net/defonds/article/details/7847446
此教程使用link方式安装插件,为了可以方便对 Eclipse 插件的管理,不至于一大堆东西都放在 plugins 目录下。
摘录步骤如下:
1.下载得到的 m2e.zip 解压缩,得到 m2e-0.12.0.20101115-1102 文件,里边有 features 目录、plugins 目录、artifacts.xml 和 content.xml
2.在 Eclipse 安装目录下新建插件文件夹 plugins_dir,将第 5 步得到的 m2e-0.12.0.20101115-1102 拷贝到 plugins_dir 目录下。
3.在 Eclipse 安装目录下新建插件文件夹 links,在 links 目录下新建文件 m2e-0.12.0.20101115-1102.link,编辑其内容如下:
path = plugins_dir/m2e-0.12.0.20101115-1102
注意:使用的是相对路径。上边 path 指的是 Eclipse 安装目录下 plugins_dir 文件夹下的 m2e-0.12.0.20101115-1102。
4. Eclipse Maven 配置
eclipse->Window->Preferences->Maven->Installations->Add...指定安装的 Maven 目录->User Settings->指定 Maven 配置文件 settings.xml。
至此,Maven 2 的 Eclipse 插件安装完毕,你可以在 Package Explorer 视图下单击右键新建 Maven 2 项目了
遇到的问题:
若在Eclipse启动时,出现上图中的情况解决方法:
1:打开eclipse Click on ‘Window’ -> ‘Preferences’ -> ‘Java’ -> ‘Installed JREs’.
If you can’t find any JDK on the list -> click ‘Add’ -> ‘Standard VM’ -> set all paths and click ‘Finish’.
After that – check this JDK on the list of installed JREs and click ‘OK’.
2:在eclipse的安装目录中找到eclipse.ini文件编辑这个文件
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
D:\Java\jdk1.5.0_08\bin
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
黑色粗体部分就是需要添加的内容
注意:添加-vm后就需要另起一行,并且-vm一定要在-vmargs这个参数的上面。