如何将MyEclipse开发的项目导入到Eclipse中运行

如题所述

由于以前的项目都是用myeclipse开发的,现在要换成eclipse来开发。但是项目导入到eclipse中发现该项目并不是web项目,也不能部署到tomcat里面去。现在解决了这个问题了。一.请首先确保你的机器上的eclipse是javaee版本的,或者已经安装看wtp插件二.先Close Project,然后修改eclipse工程下的.project文件:在 <natures </natures中加入<natureorg.eclipse.wst.common.project.facet.core.nature</nature<natureorg.eclipse.wst.common.modulecore.ModuleCoreNature</nature<natureorg.eclipse.jem.workbench.JavaEMFNature</nature在 <buildSpec </buildSpec中加入<buildCommand<nameorg.eclipse.wst.common.project.facet.core.builder</name<arguments</arguments</buildCommand<buildCommand<nameorg.eclipse.wst.validation.validationbuilder</name<arguments</arguments</buildCommand三.Open Project,然后刷新项目,在项目-右击-Properties-Project Facets-Modify Project,选择Java和Dynamic Web Module配置Context Root 和Content Directory 以及源码路径。这样就解决了。
温馨提示:内容为网友见解,仅供参考
第1个回答  2018-03-14
File>>Import>>General>>Existing Projects into Workspace 然后选择自己的项目
第2个回答  2015-12-18
具体步骤:
1、通过eclipse的import方式,将web项目导入。
2、打开.project文件,将原配置文件中的<buildSpec>...</buildSpec><natures>...</natures>部分替换为以下内容: <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文件的如下内容:
<wb-resource deploy-path="/" source-path="/WebContent"/>
改为: <wb-resource deploy-path="/" source-path="/WebRoot"/>
5、刷新项目,然后查看classpath是否有问题。
6、最后,删除eclipse默认的WebContent目录,Myeclipse默认的是WebRoot。
相似回答