elipse或Myeclipse項目轉換;myeclipse2014舉例,myeclipse

來源:互聯網
上載者:User

elipse或Myeclipse項目轉換;myeclipse2014舉例,myeclipse

有時候開發需要,要將現有的java項目轉換成java web項目,或者java項目轉換成maven項目,這時問題來了?怎麼轉換呢!本文來告訴大家一鍵轉換的方法,當然你也可以通過改變工程檔案夾下的.classpath檔案來實現轉換。

myeclipse提供的一鍵轉換功能

不管是Eclipse還是myeclipse只要記住這個操作名稱就行:ProjectFacets;下面使用myeclipse2014舉例說明下:

右鍵工程—》Myeclipse—》ProjectFacets—》轉換操作,圖示如下:

可以發現,可以進行多種類型的轉換,其中DynmicWeb Module Facets為轉換java web。

2.通過修改.classpath完成工程轉換

下面為大家一一列出不同類型項目的.classpath檔案,就一目明了了。

1)  Java工程的.classpath

很簡單,一共三個模組,src、conf、output,其中conf是IDE(開發工具的jdk,我下面設定的這個path是我新增的本地jdk,預設的是myeclipse內建的javase-6)。

<?xmlversion="1.0" encoding="UTF-8"?>

<classpath>

    <classpathentry kind="src"path="src"/>

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

         <classpathentrykind="output" path="bin"/>

</classpath>

2)  Java web工程的.classpath

可以發現,有明細的不同,javaweb工程有j2ee模組,output(輸出路徑)也不是bin,一般是WebRoot下WEB-INF下的classes,但是這個名詞是可以更改的,比如我下面的叫WebContent;還有一個不同的地方就是web項目在jdk配置下面多一個熟悉配置,<attribute name="owner.project.facets" value="java"/>

 

<?xml version="1.0" encoding="UTF-8"?>

<classpath>

         <classpathentrykind="src" path="src"/>

         <classpathentrykind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER">

                   <attributes>

                            <attributename="owner.project.facets" value="java"/>

                   </attributes>

         </classpathentry>

         <classpathentrykind="con"path="org.eclipse.jst.j2ee.internal.web.container"/>

         <classpathentrykind="con"path="org.eclipse.jst.j2ee.internal.module.container"/>

         <classpathentrykind="output" path="WebContent/WEB-INF/classes"/>

</classpath>

3)  maven工程的.classpath

mave工程就比較簡單明了了,首先的幾個src是maven規定項目結構,一個src、一個target,每個目錄下又分為main和test;另一個不同的地方就是多一個mvn的配置m2e。

<?xml version="1.0" encoding="UTF-8"?>

<classpath>

         <classpathentrykind="src" output="target/classes"path="src/main/java"/>

         <classpathentrykind="src" output="target/test-classes"path="src/test/java"/>

         <classpathentrykind="src" path="src/main/resources"/>

         <classpathentrykind="src" path="src/test/resources"/>

         <classpathentrykind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

         <classpathentrykind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>

         <classpathentrykind="output" path="target/classes"/>

</classpath>

4)  JAVA轉maven的.classpth

<?xml version="1.0" encoding="UTF-8"?>

<classpath>

         <classpathentryincluding="**/*.java" kind="src"output="target/classes" path="src/main/java">

                   <attributes>

                            <attributename="optional" value="true"/>

                            <attributename="maven.pomderived" value="true"/>

                   </attributes>

         </classpathentry>

         <classpathentryexcluding="**" kind="src" output="target/classes"path="src/main/resources">

                   <attributes>

                            <attributename="maven.pomderived" value="true"/>

                   </attributes>

         </classpathentry>

         <classpathentrykind="src" output="target/test-classes"path="src/test/java">

                   <attributes>

                            <attributename="optional" value="true"/>

                            <attributename="maven.pomderived" value="true"/>

                   </attributes>

         </classpathentry>

         <classpathentrykind="con"path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">

                   <attributes>

                            <attributename="maven.pomderived" value="true"/>

                   </attributes>

         </classpathentry>

         <classpathentrykind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER">

                   <attributes>

                            <attributename="owner.project.facets" value="java"/>

                   </attributes>

         </classpathentry>

         <classpathentrykind="output" path="target/classes"/>

</classpath>


eclipse-j2ee項目怎轉換成myeclipse WEB項目?

樓主的問題很模糊哎!你是在eclipse中有一個java項目,然後想把它發布到myeclipse中的web項目嗎?
 
eclipse與Myeclipse有什不同

Myeclipse的核心就是eclipse,只不過Myeclipse在此基礎上增加了許多的外掛程式,使用起來更加的方便。但是Myeclipse消耗的資源很多,在使用的時候一定要做好最佳化工作。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.