2011-10-02 80 views
12

我使用Eclipse靛蓝和在我的项目文件如下:缺少建设者(org.maven.ide.eclipse.maven2Builder)

<?xml version="1.0" encoding="UTF-8"?> 
    <projectDescription> 
    <name>new project</name> 
    <buildSpec> 
     <buildCommand> 
     <name>org.eclipse.jdt.core.javabuilder</name> 
     </buildCommand> 
     <buildCommand> 
     <name>org.maven.ide.eclipse.maven2Builder</name> 
     </buildCommand> 
    </buildSpec> 
    <natures> 
     <nature>org.eclipse.jdt.core.javanature</nature>  
     <nature>org.maven.ide.eclipse.maven2Nature</nature> 
    </natures> 
    </projectDescription> 

我有M2E - Maven的集成为Eclipse安装。但是我在Builders属性下找到Missing builder(org.maven.ide.eclipse.maven2Builder),并且我得到一个java.lang.ClassNotFoundException异常:当我尝试从我的项目运行一个类文件时。

我想我缺少一些东西在配置某处或插件?

感谢

回答

15

这是最有可能的声明生成器类和您的M2E插件之间的不匹配。 试试这个:

<?xml version="1.0" encoding="UTF-8"?> 
<projectDescription> 
    <name>new project</name> 
    <buildSpec> 
     <buildCommand> 
      <name>org.eclipse.jdt.core.javabuilder</name> 
     </buildCommand> 
     <buildCommand> 
      <name>org.eclipse.m2e.core.maven2Builder</name> 
     </buildCommand> 
    </buildSpec> 
    <natures> 
     <nature>org.eclipse.jdt.core.javanature</nature> 
     <nature>org.eclipse.m2e.core.maven2Nature</nature> 
    </natures> 
</projectDescription> 

请注意不同org.eclipse.m2e.core命名空间。

+0

更改为org.eclipse.m2e.core为我工作! – vee

+0

从Eclipse Indigo 3.7.2升级到Juno 4.2.1并安装最新的m2e与以前安装的旧版m2e相比,此处同样存在问题。这个解决方案马上工作。 –

1

虽然转换到较新的m2e插件可能有效,但它可能不会。您可以安装使用Indigo中旧标签的旧版m2e插件。见http://m2eclipse.sonatype.org/installing-m2eclipse.html。不幸的是,你不能同时安装旧版本和新版本,所以如果你设法安装新版本,你必须在安装旧版本之前先卸载它。

1

@ LucaGeretti的回答正是我的问题,这在Eclipse靛蓝固定,可以从IDE容易实现:

  1. 右键单击您的项目。
  2. 选择'配置'。
  3. 点击'转换为Maven项目'。