`
FQ_kevin
  • 浏览: 14441 次
  • 性别: 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代码 

<buildSpec>
       <buildCommand> 
            <name>org.eclipse.wst.common.project.facet.core.builder</name> 
            <arguments> 
            </arguments>  
       </buildCommand>  
       <buildCommand> 
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> 
            <arguments> 
            </arguments>  
       </buildCommand>  
       <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.ast.deploy.core.DeploymentBuilder</name> 
            <arguments> 
            </arguments> 
        </buildCommand> 
 </buildSpec>
 <natures>
  <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> 
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> 
        <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature> 
        <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature> 
        <nature>org.eclipse.jdt.core.javanature</nature> 
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature> 
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature> 
 </natures>

 

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

 

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

Java代码 

<wb-resource deploy-path="/" source-path="/WebContent"/>  

 

改为:

 

Java代码 

<wb-resource deploy-path="/" source-path="/WebRoot"/>  

 

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

 

注:转自http://wangshi-ws.iteye.com/blog/1564351

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics