MyEclipse菜單add hibernate capabilities反灰不可用解決

轉:http://hybxiaodao.iteye.com/blog/1169168


你如果點中單獨一個文件,那麼那個選項一直都是反灰,只有你點中整個項目名,那個選項就可用了。

 

不是什麼版本問題

用myEclipse搭建hibernate框架後,有時搞亂了某些東西后,又想重新加載Hibernate包,但此時 addhibernate capabilities功能菜單竟然是灰色的,不可用,尤其是初學的朋友往往要重建web項目,一切都要重新來過。

其實大可不必這麼做。有個簡單的方法可以解決這個問題:

切換到java的導航試圖,在項目的根目錄下又個項目配置文件:".project",打開後如下代碼所示。

view plaincopy to clipboardprint?
<?xml version="1.0"encoding="UTF-8"?>  
<projectDescription>  
   <name>CourseMS</name>  
   <comment></comment>  
   <projects>  
   </projects>  
   <buildSpec>  
       <buildCommand>  
           <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>  
           <arguments>  
           </arguments>  
       </buildCommand>  
       <buildCommand>  
           <name>org.eclipse.jdt.core.javabuilder</name>  
           <arguments>  
           </arguments>  
       </buildCommand>  
       <buildCommand>  
           <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>  
           <arguments>  
           </arguments>  
       </buildCommand>  
       <buildCommand>  
           <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>  
           <arguments>  
           </arguments>  
       </buildCommand>  
       <buildCommand>  
           <name>org.eclipse.wst.validation.validationbuilder</name>  
           <arguments>  
           </arguments>  
       </buildCommand>  
       <buildCommand>  
           <name>com.genuitec.eclipse.hibernate.HibernateBuilder</name>  
           <arguments>  
           </arguments>  
       </buildCommand>  
   </buildSpec>  
   <natures>  
       <nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>  
       <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>  
       <nature>org.eclipse.jdt.core.javanature</nature>  
       <nature>org.eclipse.wst.jsdt.core.jsNature</nature>  
   </natures>  
</projectDescription> 
<?xml version="1.0"encoding="UTF-8"?>
<projectDescription>
 <name>CourseMS</name>
 <comment></comment>
 <projects>
 </projects>
 <buildSpec>
  <buildCommand>
   <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>org.eclipse.jdt.core.javabuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>org.eclipse.wst.validation.validationbuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
  <buildCommand>
   <name>com.genuitec.eclipse.hibernate.HibernateBuilder</name>
   <arguments>
   </arguments>
  </buildCommand>
 </buildSpec>
 <natures>
  <nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>
  <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
  <nature>org.eclipse.jdt.core.javanature</nature>
  <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
 </natures>
</projectDescription>

一般在最下方有:

view plaincopy to clipboardprint?
<buildCommand>  
           <name>com.genuitec.eclipse.hibernate.HibernateBuilder</name>  
           <arguments>  
           </arguments>  
       </buildCommand> 
<buildCommand>
   <name>com.genuitec.eclipse.hibernate.HibernateBuilder</name>
   <arguments>
   </arguments>
  </buildCommand>

view plaincopy to clipboardprint?
<nature>com.genuitec.eclipse.hibernate.hibernatenature</nature> 
<nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>

將這兩段刪除即可


發佈了5 篇原創文章 · 獲贊 1 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章