建立web項目後產生的設定檔解析

來源:互聯網
上載者:User

標籤:

一、.mymetadata檔案
1、部署項目用的,把項目部署到tomcat伺服器上時,如果沒有這個檔案,用myeclipse/Eclipse部署是不能部署到關聯的tomcat伺服器。
.mymetadata檔案:
.mymetadata代碼  收藏代碼

    <?xml version=”1.0” encoding=”UTF-8”?>  
    <!--  
    type : 工程類型  
    name : 工程名稱  
    id : 工程在工作空間內的唯一標識  
    context-root : 網站根路徑  
    j2ee-spec: J2EE標準  
    archive : 打包後war檔案  
    -->  
    <project-module  
    type=”WEB”  
    name=”PheebsKM”  
    id=”myeclipse.1152954865843”  
    context-root=”/PheebsKM”  
    j2ee-spec=”1.4”  
    archive=”PheebsKM.war”>  
      
    <attributes>  
      <!-- value : Web根目錄名稱 -->  
        <attribute name=”webrootdir” value=”WebRoot” />  
    </attributes>  
    </project-module>  


2、在MyEclipse/Eclipse更改項目發布到Tomcat的檔案夾
   (1)、在自己的workspace中找到當前使用的項目,找到檔案.mymetadata,開啟後就會看見標籤context- root=”/example”(example是自己應用的名稱),可以將其改為別的名稱。
   (2)、選擇:工程右鍵 --》Properties --》Myeclipse --》 Web
   [Web-root folder]:/WebRoot
   [Web Context-root]:/ROOT,修改context-root對應的值即可。(預設值:當前項目名稱)
二、.project檔案
.project代碼  收藏代碼

    <?xml version=”1.0” encoding=”UTF-8”?>  
    <projectDescription>  
    <!-- 工程名稱 <name>-->  
    <name>PheebsKM</name>  
    <comment></comment>  
    <projects></projects>  
    <!-- 編譯器指定 <buildSpec>-->  
    <buildSpec>  
    <buildCommand>  
    <name>org.eclipse.jdt.core.javabuilder</name>  
    <arguments></arguments>  
    </buildCommand>  
    </buildSpec>  
    <!-- 核心特性 <natures> -->  
    <natures>  
    <nature>org.eclipse.jdt.core.javanature</nature>  
    </natures>  
    </projectDescription>  


對於.project檔案不需要手動修改。

三、.classpath檔案
.classpath代碼  收藏代碼

    <?xml version="1.0" encoding="UTF-8"?>  
    <classpath>  
            <!-- 源碼目錄 -->  
        <classpathentry excluding="main/|webservices/|patterns/|web/|jdk/|resources/|jquery/|util/|jdon/|hotel/" kind="src" path="src"/>  
        <classpathentry kind="src" path="src/hotel"/>  
        <classpathentry kind="src" path="src/jdon"/>  
        <classpathentry kind="src" path="src/webservices"/>  
        <classpathentry kind="src" path="src/patterns"/>  
        <classpathentry kind="src" path="src/web"/>  
        <classpathentry kind="src" path="src/jdk"/>  
        <classpathentry kind="src" path="src/resources"/>  
        <classpathentry kind="src" path="src/jquery"/>  
        <classpathentry kind="src" path="src/util"/>  
            <!-- JDK運行時容器 -->  
        <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>  
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_17"/>  
           <!-- 以下為類庫,path為自訂的目錄,需要匯入的jar檔案 -->  
        <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/lib_jar"/>  
            <!-- 編譯後輸出class目錄 -->  
        <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>  
    </classpath>  


說明:
   1、有時候在一個Web工程裡我們需要加入第三方jar包,這時你加入的最好相對路徑,
而不是絕對路徑。否則你的工程拿到別處就不能運行了。意思就是說你最好把相關的jar放到工程目錄下。對於Web工程來說相對簡單,web工程是有個lib目錄的。直接複製到這裡就行了。
  2、若在eclipse中匯入其他項目,除了更改引入jar目錄外,還可能需要修改.project或.mymetadata檔案。

建立web項目後產生的設定檔解析

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.