Eclipse+Maven创建webapp项目:(转)
http://www.cnblogs.com/candle806/p/3439469.html
pom.xml
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eve-store</groupId>
<artifactId>eveStore-M</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>eveStore-MS Maven Webapp</name>
<url>http://maven.apache.org</url>
<!-- 参数设置 -->
<properties>
<spring.version>4.3.0.RELEASE</spring.version>
<log4j.version>1.2.9</log4j.version>
<java.version>1.7</java.version>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
</properties>
<!-- 依赖关系 start-->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<!-- 适用范围 test文件夹下-->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- end spring 核心依赖包 -->
<!-- start spring mvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- end spring mvc -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<!-- 依赖关系 end -->
<build>
<finalName>eveStore-M</finalName>
<!-- 插件 -->
<plugins>
<plugin> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<!-- 端口 -->
<port>9090</port>
<!-- 路径 -->
<path>/eve</path>
<uriEncoding>UTF-8</uriEncoding>
<finalName>eve</finalName>
<!-- 服务器 -->
<server>tomcat6</server>
</configuration>
</plugin>
</plugins>
</build>
</project>
在maven –> conf –> setting.xml
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->
<!-- Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
<!-- 设置 -->
<server>
<id>tomcat6</id>
<username>admin</username>
<password>admin</password>
</server>
运行 mvn tomcat6:run 时发现下面报错
-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
解决方法:(转)
http://fxb4632242.iteye.com/blog/2193945
tomcat插件:(转)
http://blog.csdn.net/binyao02123202/article/details/17793233