MyEclipse 6.5安装maven插件

时间:2022-01-23 19:22:52

一、卸载原有maven插件

MyEclipse 6.5集成了Maven插件,不过有不少bug,用习惯了m2eclipse,不想在这上面浪费时间。要安装m2eclipse,需要先把自带的maven插件卸载掉,卸载步骤如下:
1.删除/eclipse/features/com.genuitec.myeclipse.maven_6.5.1.zmyeclipse650200806目录
2.进入plugins目录,删除以下目录及jar包

 1 com.genuitec.myeclipse.maven_6.5.1.zmyeclipse650200806
 2 org.maven.ide.components.archetype_common_2.0.0.20080331-1600
 3 org.maven.ide.components.maven_embedder_2.1.0.20080410-2200
 4 org.maven.ide.components.maven_model_edit_1.0.0.20080331-1600
 5 org.maven.ide.components.maven_scm_1.0.0.20080410-2200
 6 org.maven.ide.components.nexus_indexer_1.0.0.20080331-1600
 7 org.maven.ide.components.qname_1.0.0.20080331-1600
 8 com.genuitec.eclipse.maven_6.5.1.zmyeclipse650200806.jar
 9 org.maven.ide.eclipse.central_0.9.1.zmyeclipse650200806.jar 
10 org.maven.ide.eclipse.scm_0.9.2.zmyeclipse650200806.jar
11 org.maven.ide.eclipse_0.9.3.zmyeclipse650200806.jar

二、在线安装m2eclipse

1.Help -> Find and Install ->Search for new features to install->New Remote Site

1 name:m2eclipse
2 url:http://m2eclipse.sonatype.org/sites/m2e/0.10.0.20100209-0800/

2.点击Finish,开始自动搜索。这个链接之前是好用的,不过今天再下载总是提示错误,直接访问也提示内容找不到,看来是挪地方了。最后在官网找到这个帖子Where did http://m2eclipse.sonatype.org/sites/m2e go?根据提示找到了最新地址http://repository.sonatype.org/content/sites/forge-sites/m2e/
帖子内容

As of June 2013, that site has been shut down because M2Eclipse was moved to the Eclipse Foundation years ago.

You can access the archived M2Eclipse sites (including 0.12) here:

https://repository.sonatype.org/content/sites/forge-sites/m2e/

For more information on how to access current m2e releases, see http://eclipse.org/m2e/download/.

所以上面的地址变成了这样

1 name:m2eclipse
2 url:http://repository.sonatype.org/content/sites/forge-sites/m2e/0.10.0/S/20100209-0800/

再安装就没有问题了。

3.设置maven

Window->preferences,搜索maven,User Settings中选择本地maven配置文件,Update Settings->Apply->OK

三、问题

重启MyEclipse后,跳出异常

1 Eclipse is running in a JRE, but a JDK is required
2 Some Maven plugins may not work when importing projects or updating source folders.

具体的解决方案见这个链接http://www.blogjava.net/itvincent/archive/2010/07/25/327101.html

安装Maven后提示找不到JDK的错误 。The Maven Integration requires that Eclipse be running in a JDK

在eclipse中安装了m2eclipse(maven插件)

在安装后,出现下列警告:

The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDK.

Please make sure the -vm option in eclipse.ini is pointing to a JDK and verify that Installed JRE’s are also using JDK installs.

解决:

(1)设置系统安装的JDK目录set your JDK as a default Java environment in eclipse (default installed JRE)

Open 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)增加JDK路径到eclipse.ini文件中add path to your SDK in eclipse.ini

open ‘eclipse.ini’ and add there: -vm path_to_javaw_on_your_machine,so in my example it will be (jdk1.6.0_17 on Windows):-vm
D:\\Java\jdk1.6.0_13\jre\bin\javaw
不能有空格,否则要用~1代替,如: ‘Program Files’ is ‘Progra~1′. Notice 1: Do not use paths with spaces! Replace all dir names with spaces to their shortcuts. For example: ‘Program Files’ is ‘Progra~1′.
要分为2行写。Notice 2: ‘-vm’ is in the first line, path is in the second line

your ‘eclipse.ini’ looks like this:

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
D:\Java\jdk1.6.0_13\jre\bin\javaw
-vmargs
-Xms40m
-Xmx256m
-vm要在-vmargs前面。Notice : ‘-vm’ must be  "-vmargs" above

重启eclipse。Restart eclipse and everything should be fine.