缺少构建器(org.maven.ide.eclipse.maven2Builder)

use*_*942 12 eclipse maven

我正在使用Eclipse Indigo并在我的.project文件中包含以下内容:

<?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>
Run Code Online (Sandbox Code Playgroud)

我安装了m2e - Maven Integration for Eclipse.但是我在Builders属性下得到了Missing builder(org.maven.ide.eclipse.maven2Builder),我得到了一个java.lang.ClassNotFoundException:当我尝试从我的项目运行一个类文件时.

我想我在配置某处或插件中遗漏了一些东西?

谢谢

Luc*_*tti 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>
Run Code Online (Sandbox Code Playgroud)

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