2011-10-02 85 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項目'。