歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 將IntelliJ IDEA創建的Web項目轉換為MyEclipse版本的Web項目

將IntelliJ IDEA創建的Web項目轉換為MyEclipse版本的Web項目

日期:2017/3/1 9:35:57   编辑:Linux編程

將IntelliJ IDEA創建的Web項目轉換為MyEclipse版本的Web項目,主要創建如下文件,並修改其中的內容:

一、.project文件(注意前面的·)

<span ><?xml version=”1.0″ encoding=”UTF-8″?>

<projectDescription>

</span><span ><name>Test</name></span><span >

<comment></comment>

<projects>

</projects>

<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>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>

<nature>org.eclipse.jem.workbench.JavaEMFNature</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>

<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>

</natures>

</projectDescription></span>

主要修改的是name,將name修改為你具體工程的名稱。

二、.classpath

<span ><?xml version=”1.0″ encoding=”UTF-8″?>

<classpath>

</span><span ><classpathentry kind=”src” path=”src”/></span><span >

<classpathentry kind=”con” path=”org.eclipse.jdt.launching.JRE_CONTAINER”/>

<classpathentry kind=”con” path=”melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_6_CONTAINER”/>

<classpathentry kind=”con” path=”org.eclipse.jst.j2ee.internal.web.container”/>

<classpathentry kind=”con” path=”org.eclipse.jst.j2ee.internal.module.container”/>

</span><span ><classpathentry kind=”output” path=”web/WEB-INF/classes”/></span><span >

</classpath></span>

主要修改的是src屬性和output屬性,修改為你工程具體的路徑,例如,本人的web元素是放在web下的,MyEclipse創建的工程默認是放在WebRoot目錄下的

三、.mymetadata

<span ><?xml version=”1.0″ encoding=”UTF-8″?>

<project-module

</span><span > type=”WEB”</span><span >

</span><span > name=”Test”</span><span >

id=”myeclipse.1407308101935″

</span><span > context-root=”/Test”</span><span >

j2ee-spec=”6.0″

</span><span > archive=”Test.war”></span><span >

<attributes>

</span><span > <attribute name=”webrootdir” value=”web” /></span><span >

</attributes>

</project-module></span>

修改具體對應的項目名稱為你工程對應的

四、創建目錄.settings

在該目錄下主要創建如下6個文件:

(1) org.eclipse.core.resources.prefs

#Wed Aug 06 15:01:06 CST 2014

eclipse.preferences.version=1

encoding/<project>=UTF-8

(2) org.eclipse.jdt.core.prefs

#Wed Aug 06 14:55:08 CST 2014

eclipse.preferences.version=1

org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

org.eclipse.jdt.core.compiler.compliance=1.6

org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

org.eclipse.jdt.core.compiler.source=1.6

(3) org.eclipse.wst.common.component

<span ><?xml version=”1.0″ encoding=”UTF-8″?>

<project-modules id=”moduleCoreId” project-version=”1.5.0″>

</span><span ><wb-module deploy-name=”Test”></span><span >

</span><span ><wb-resource deploy-path=”/” source-path=”/web”/></span><span >

</span><span ><wb-resource deploy-path=”/WEB-INF/classes” source-path=”/src”/></span><span >

</span><span > <property name=”context-root” value=”/Test”/></span><span >

</span><span ><property name=”java-output-path” value=”/Test/web/WEB-INF/classes”/></span><span >

</wb-module>

</project-modules></span>

修改每個路徑為你工程目錄對應的路徑

(4) org.eclipse.wst.common.project.facet.core.xml

<?xml version=”1.0″ encoding=”UTF-8″?>

<faceted-project>

<fixed facet=”wst.jsdt.web”/>

<installed facet=”java” version=”1.6″/>

<installed facet=”jst.web” version=”3.0″/>

<installed facet=”wst.jsdt.web” version=”1.0″/>

</faceted-project>

(5) org.eclipse.wst.jsdt.ui.superType.container

空目錄,創建這個文件即可;

(6) org.eclipse.wst.jsdt.ui.superType.name

空目錄,創建這個文件即可。

執行完上述步驟之後,就可以使用MyEclipse的import選項導入進去了。

IntelliJ IDEA: 字體美化(anti-aliased)和字體添加 http://www.linuxidc.com/Linux/2013-11/92609.htm

IntelliJ IDEA 12 創建Web項目圖文詳細教程 http://www.linuxidc.com/Linux/2013-05/84213.htm

用IntelliJ IDEA開發Android程序圖文教程 http://www.linuxidc.com/Linux/2013-03/81471.htm

IntelliJ IDEA 12開發haXe NME應用配置指南 http://www.linuxidc.com/Linux/2013-01/77227.htm

IntelliJ IDEA運行Play Framework的test mode http://www.linuxidc.com/Linux/2013-07/87694.htm

Ubuntu 13.04 安裝IntelliJ IDEA 12 http://www.linuxidc.com/Linux/2013-11/93014.htm

IntelliJ IDEA 12創建Maven管理的Java Web項目(圖解) http://www.linuxidc.com/Linux/2014-04/99687p2.htm

IntelliJ IDEA 的詳細介紹:請點這裡
IntelliJ IDEA 的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved