2014-10-27 125 views
-2

我不擅長Maven項目的東西,所以我想將它轉換爲Eclipse中的動態Web項目。這個Maven項目包含一個Web項目和其他子項目。真的不知道如何將所有這些支持的項目與maven Web項目一起轉換爲基於Eclipse的動態Web項目。請幫忙。現有的Maven項目到基於Eclipse的動態Web項目

回答

0

增加您的POM

 <!-- Maven Eclipse Plugin --> 
     <!-- version 2.9 has testSourcesLast flag but does not delete .settings --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-eclipse-plugin</artifactId> 
      <version>2.8</version> 
      <configuration> 
       <useProjectReferences>false</useProjectReferences> 
      </configuration> 
     </plugin> 

這在屬性這個插件:eclipseTomcatServer必須在eclipse

<eclipseTomcatServer>Apache Tomcat v7.0</eclipseTomcatServer> 

你的tomcat的名稱相匹配,這在您的個人資料

<profiles> 
    <!-- profile to enable WTP in Eclipse --> 
    <profile> 
     <id>wtp</id> 
     <activation> 
      <file> 
       <exists>src/main/webapp</exists> 
      </file> 
     </activation> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-eclipse-plugin</artifactId> 
        <configuration> 
         <downloadSources>false</downloadSources> 
         <downloadJavadocs>false</downloadJavadocs> 
         <!-- WTP version --> 
         <wtpversion>2.0</wtpversion> 
         <!-- WTP server --> 
         <wtpdefaultserver>${eclipseTomcatServer}</wtpdefaultserver> 
         <classpathContainers> 
          <!-- Libraries from JRE --> 
          <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer> 
          <!-- Libraries from server container --> 
          <classpathContainer>org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/${eclipseTomcatServer}</classpathContainer> 
          <!-- Libraries from META-INF/MANIFEST.MF --> 
          <!-- <classpathContainer>org.eclipse.jst.j2ee.internal.web.container</classpathContainer> --> 
          <!-- Libraries from WEB-INF/lib --> 
          <!-- <classpathContainer>org.eclipse.jst.j2ee.internal.module.container</classpathContainer> --> 
          <classpathContainer>org.eclipse.jst.j2ee.internal.web.container/artifact</classpathContainer> 
         </classpathContainers> 
         <additionalBuildcommands> 
          <!-- JavaScript support --> 
          <buildcommand>org.eclipse.wst.jsdt.core.javascriptValidator</buildcommand> 
         </additionalBuildcommands> 
         <additionalProjectnatures> 
          <!-- JavaScript support --> 
          <projectnature>org.eclipse.wst.jsdt.core.jsNature</projectnature> 
         </additionalProjectnatures> 
         <additionalProjectFacets> 
          <!-- JavaScript support --> 
          <wst.jsdt.web>1.0</wst.jsdt.web> 
         </additionalProjectFacets> 
        </configuration> 
       </plugin> 


      </plugins> 
     </build> 
    </profile> 

</profiles> 

然後鍵入命令

mvn eclipse:eclipse 

mvn eclipse:eclipse -Dwtpversion=[wtp version, usually 2.0 ] 
相關問題