`
wangyanlong0107
  • 浏览: 480565 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

【转】将java项目从myeclipse导入eclipse中,我们不得不知道的那些事

 
阅读更多

众所周知,myeclipse自带了很多实用的插件,正因为这些插件的强大功能,帮助web程序猿提高了开发效率,同时也看到了无限明媚的春天!而eclipse给大家的印象则是,绿色软件,体积小,速度快,界面清爽,这些都是它显著的优点,当然,它也有缺点,那就是功能相对myeclipse而言比较少。虽然eclipse也可通过扩展插件来增加很多与myeclipse相同的功能,但很多人习惯了拿来主义,自己去折腾这样或那样的插件总觉得麻烦,还不如直接安装myeclipse,一会功夫,全部搞定,接着便可以大展拳脚,开始自己的宏图大业。不过,我要说的是,那是曾经的eclipse,现在eclipse推出了很多开发版本,无论你是c++,还是java,eclipse都提供了相应的开发版本。比如做java的web开发,eclipse有对应的j2ee版本。当然,萝卜青菜各有所爱,每个人都有它喜欢的IDE,并且每个IDE都有它的优点和缺点。就比如我,我喜欢不耗内存的,界面漂亮的工具,所以eclipse肯定是我的最爱,尤其爱eclipse中代码的字体和颜色搭配得很好,看起来很舒服。当然,还有个客观的原因,那就是开发语言是java,正是因为这个原因,所以当遇到myeclipse的web项目,如果我需要把这个项目直接导入到我的eclipse工作目录中,就需要进行一些配置上的修改,如果不修改,项目将无法直接运行。以下是具体步骤:

1、通过eclipse的import方式,将web项目导入。

2、打开.project文件,将原配置文件中的<buildSpec>...</buildSpec><natures>...</natures>部分替换为以下内容:

 

Java代码 
  1. <buildSpec>  
  2.         <buildCommand>  
  3.             <name>org.eclipse.wst.common.project.facet.core.builder</name>  
  4.             <arguments>  
  5.             </arguments>  
  6.         </buildCommand>  
  7.         <buildCommand>  
  8.             <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>  
  9.             <arguments>  
  10.             </arguments>  
  11.         </buildCommand>  
  12.         <buildCommand>  
  13.             <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>  
  14.             <arguments>  
  15.             </arguments>  
  16.         </buildCommand>  
  17.         <buildCommand>  
  18.             <name>org.eclipse.jdt.core.javabuilder</name>  
  19.             <arguments>  
  20.             </arguments>  
  21.         </buildCommand>  
  22.         <buildCommand>  
  23.             <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>  
  24.             <arguments>  
  25.             </arguments>  
  26.         </buildCommand>  
  27.         <buildCommand>  
  28.             <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>  
  29.             <arguments>  
  30.             </arguments>  
  31.         </buildCommand>  
  32.         <buildCommand>  
  33.             <name>org.eclipse.wst.validation.validationbuilder</name>  
  34.             <arguments>  
  35.             </arguments>  
  36.         </buildCommand>  
  37.         <buildCommand>  
  38.             <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>  
  39.             <arguments>  
  40.             </arguments>  
  41.         </buildCommand>  
  42.     </buildSpec>  
  43.     <natures>  
  44.         <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>  
  45.         <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>  
  46.         <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>  
  47.         <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>  
  48.         <nature>org.eclipse.jdt.core.javanature</nature>  
  49.         <nature>org.eclipse.wst.jsdt.core.jsNature</nature>  
  50.         <nature>org.eclipse.wst.common.project.facet.core.nature</nature>  
  51.     </natures>  

 

3、刷新项目,项目->右键->Properties->Project Facets->Configuration->custom,选择Java和Dynamic Web Module(注意版本,如果无法确定自己的版本,请从高往低测试)

4、修改.settings目录(可在navigator视图下查看)中org.eclipse.wst.common.component文件的如下内容:

 

Java代码 
  1. <wb-resource deploy-path="/" source-path="/WebContent"/>  

改为:

 

 

Java代码 
  1. <wb-resource deploy-path="/" source-path="/WebRoot"/>  

 

5、刷新项目,然后查看classpath是否有问题。
6、最后,删除eclipse默认的WebContent目录,Myeclipse默认的是WebRoot。

 

一切大功告成,自此便可以部署和访问了。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics