1. 程式人生 > >myeclipse 2014新建maven web 專案步驟

myeclipse 2014新建maven web 專案步驟

首先在myeclipse中配置maven的安裝路徑:


新建web專案:

pom.xml檔案報錯解決辦法:


在pom.xml中加上:

 <plugins>      
     <plugin>  
	    <groupId>org.apache.maven.plugins</groupId>  
	    <artifactId>maven-resources-plugin</artifactId>  
	    <version>2.6</version>  
	     <configuration>  
	       <encoding>utf-8</encoding>  
	     </configuration>  
      </plugin> 
  </plugins>

如果專案結構沒有Maven Dependencies



需要在專案根路徑下的.classpath檔案里加上

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
	<attributes>
	<attribute name="maven.pomderived" value="true"/>
	<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
	</attributes>
</classpathentry>

如果專案啟動時報maven與jdk版本不對應,需要新增一行程式碼:

MAVEN_HOME是你在環境變數裡配置的maven安裝路徑

-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME

本人搭建的maven web專案,框架用spring springMVC mybatis,架包都是最新的,已經上傳,需要的可以下載