1、创建Maven工程
1.1、Fill-->New Maven Project-->Next-->maven-archetype-webapp-->Next-->输入group id和artiface id点击finish完成,这里group id和artiface id就是标识项目唯一坐标的作用,这里不做介绍,然后把工程目录调整下,这样就是个标准的maven工程了。
1.2、编写pom文件,有了maven真的极大的方便了我们构建项目,这里maven帮我们把编写在pom文件中的jar包加入工程中。
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.deng.mybatis</groupId> 5 <artifactId>test1118</artifactId> 6 <packaging>war</packaging> 7 <version>0.0.1-SNAPSHOT</version> 8 9 <properties> 10 <spring-version>3.2.0.RELEASE</spring-version> 11 </properties> 12 13 <dependencies> 14 <dependency> 15 <groupId>junit</groupId> 16 <artifactId>junit</artifactId> 17 <version>4.12</version> 18 <scope>test</scope> 19 </dependency> 20 21 <dependency> 22 <groupId>org.mybatis</groupId> 23 <artifactId>mybatis</artifactId> 24 <version>3.3.0</version> 25 </dependency> 26 27 <dependency> 28 <groupId>mysql</groupId> 29 <artifactId>mysql-connector-java</artifactId> 30 <version>5.1.37</version> 31 </dependency> 32 33 <dependency> 34 <groupId>log4j</groupId> 35 <artifactId>log4j</artifactId> 36 <version>1.2.17</version> 37 </dependency> 38 39 <dependency> 40 <groupId>org.springframework</groupId> 41 <artifactId>spring-core</artifactId> 42 <version>${spring-version}</version> 43 </dependency> 44 <dependency> 45 <groupId>org.springframework</groupId> 46 <artifactId>spring-context</artifactId> 47 <version>${spring-version}</version> 48 </dependency> 49 <dependency> 50 <groupId>org.springframework</groupId> 51 <artifactId>spring-jdbc</artifactId> 52 <version>${spring-version}</version> 53 </dependency> 54 <dependency> 55 <groupId>org.springframework</groupId> 56 <artifactId>spring-orm</artifactId> 57 <version>${spring-version}</version> 58 </dependency> 59 <dependency> 60 <groupId>org.springframework</groupId> 61 <artifactId>spring-web</artifactId> 62 <version>${spring-version}</version> 63 </dependency> 64 <dependency> 65 <groupId>org.springframework</groupId> 66 <artifactId>spring-tx</artifactId> 67 <version>${spring-version}</version> 68 </dependency> 69 <dependency> 70 <groupId>org.springframework</groupId> 71 <artifactId>spring-webmvc</artifactId> 72 <version>${spring-version}</version> 73 </dependency> 74 <dependency> 75 <groupId>org.springframework</groupId> 76 <artifactId>spring-test</artifactId> 77 <version>${spring-version}</version> 78 </dependency> 79 <dependency> 80 <groupId>org.springframework</groupId> 81 <artifactId>spring-expression</artifactId> 82 <version>${spring-version}</version> 83 </dependency> 84 <dependency> 85 <groupId>org.springframework</groupId> 86 <artifactId>spring-context-support</artifactId> 87 <version>${spring-version}</version> 88 </dependency> 89 <dependency> 90 <groupId>org.springframework</groupId> 91 <artifactId>spring-beans</artifactId> 92 <version>${spring-version}</version> 93 </dependency> 94 <dependency> 95 <groupId>org.springframework</groupId> 96 <artifactId>spring-aspects</artifactId> 97 <version>${spring-version}</version> 98 </dependency> 99 <dependency> 100 <groupId>org.springframework</groupId> 101 <artifactId>spring-aop</artifactId> 102 <version>${spring-version}</version> 103 </dependency> 104 <dependency> 105 <groupId>org.mybatis</groupId> 106 <artifactId>mybatis-spring</artifactId> 107 <version>1.2.2</version> 108 </dependency> 109 110 <dependency> 111 <groupId>commons-dbcp</groupId> 112 <artifactId>commons-dbcp</artifactId> 113 <version>1.4</version> 114 </dependency> 115 116 <dependency> 117 <groupId>net.sf.ehcache</groupId> 118 <artifactId>ehcache-core</artifactId> 119 <version>2.6.6</version> 120 </dependency> 121 122 <dependency> 123 <groupId>org.mybatis</groupId> 124 <artifactId>mybatis-ehcache</artifactId> 125 <version>1.0.0</version> 126 </dependency> 127 128 </dependencies> 129 <build> 130 <finalName>test1118</finalName> 131 </build> 132 </project>