pom.xml文件內容java
1 <!-- 第一行是XML頭,指定了該xml文檔的版本和編碼方式 --> 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4 <modelVersion>4.0.0</modelVersion><!-- 指定了當前POM模型的版本,對於Maven2及Maven 3來講,它只能是4.0.0。 --> 5 6 <!-- groupId,artifactId和version三行。這三個元素定義了一個項目基本的座標 --> 7 <groupId>com.yeepay.test</groupId><!--定義了項目屬於哪一個組 --> 8 <artifactId>TestSM</artifactId><!--定義了當前Maven項目在組中惟一的ID --> 9 <packaging>war</packaging><!--指定打包類型,能夠是war,jar,pom,ear等形式 --> 10 <version>0.0.1-SNAPSHOT</version><!--指定了項目當前的版本 SNAPSHOT意爲快照,說明該項目還處於開發中,是不穩定的版本。 --> 11 12 <name>TestSM Maven Webapp</name><!--項目的名稱, Maven產生的文檔用 --> 13 <url>http://maven.apache.org</url> <!--項目主頁的URL, Maven產生的文檔用--> 14 15 16 <!-- 17 合成多個模塊:一個項目有多個模塊,也叫作多重模塊,或者合成項目 18 <modules> 19 <module>nonbankcard-common</module> 20 <module>nonbankcard-facade</module> 21 <module>nonbankcard-core</module> 22 <module>nonbankcard-hessian</module> 23 </modules> 24 --> 25 <!-- 26 父項目的座標。若是項目中沒有規定某個元素的值.父項目的packaging節點值是pom 27 <parent> 28 <groupId></groupId> 29 <artifactId></artifactId> 30 <version></version> 31 父項目的pom.xml文件的相對路徑。相對路徑容許你選擇一個不一樣的路徑。 32 默認值是../pom.xml。Maven首先在構建當前項目的地方尋找父項目的pom, 33 其次在文件系統的這個位置(relativePath位置), 34 而後在本地倉庫 35 最後在遠程倉庫尋找父項目的pom。 36 <relativePath></relativePath> 37 </parent> 38 --> 39 40 <!-- 該元素下能夠包含多個dependency元素以聲明項目的依賴,前面咱們提到groupId、artifactId和version是任何一個Maven項目最基本的座標 --> 41 <dependencies> 42 <dependency> 43 <groupId>junit</groupId> 44 <artifactId>junit</artifactId> 45 <version>3.8.1</version> 46 <scope>test</scope> 47 </dependency> 48 <dependency> 49 <groupId>org.springframework</groupId> 50 <artifactId>spring-web</artifactId> 51 <version>3.2.0.RELEASE</version> 52 </dependency> 53 <dependency> 54 <groupId>org.springframework</groupId> 55 <artifactId>spring-webmvc</artifactId> 56 <version>3.2.0.RELEASE</version> 57 </dependency> 58 <dependency> 59 <groupId>org.springframework</groupId> 60 <artifactId>spring-orm</artifactId> 61 <version>3.2.0.RELEASE</version> 62 </dependency> 63 <dependency> 64 <groupId>commons-fileupload</groupId> 65 <artifactId>commons-fileupload</artifactId> 66 <version>1.3.1</version> 67 </dependency> 68 <dependency> 69 <groupId>javax.servlet</groupId> 70 <artifactId>jstl</artifactId> 71 <version>1.2</version> 72 </dependency> 73 <dependency> 74 <groupId>taglibs</groupId> 75 <artifactId>standard</artifactId> 76 <version>1.1.2</version> 77 </dependency> 78 <dependency> 79 <groupId>org.mybatis</groupId> 80 <artifactId>mybatis</artifactId> 81 <version>3.2.7</version> 82 </dependency> 83 <dependency> 84 <groupId>org.mybatis</groupId> 85 <artifactId>mybatis-spring</artifactId> 86 <version>1.2.2</version> 87 </dependency> 88 <dependency> 89 <groupId>mysql</groupId> 90 <artifactId>mysql</artifactId> 91 <version>1</version> 92 </dependency> 93 <dependency> 94 <groupId>javax.servlet</groupId> 95 <artifactId>servlet-api</artifactId> 96 <version>2.4</version> 97 <scope>provided</scope> 98 </dependency> 99 <dependency> 100 <groupId>com.alibaba</groupId> 101 <artifactId>fastjson</artifactId> 102 <version>1.1.25</version> 103 </dependency> 104 <dependency> 105 <groupId>cglib</groupId> 106 <artifactId>cglib</artifactId> 107 <version>3.0</version> 108 </dependency> 109 110 <dependency> 111 <groupId>org.aspectj</groupId> 112 <artifactId>aspectjrt</artifactId> 113 <version>1.6.11</version> 114 </dependency> 115 116 <dependency> 117 <groupId>org.aspectj</groupId> 118 <artifactId>aspectjweaver</artifactId> 119 <version>1.6.11</version> 120 </dependency> 121 <dependency> 122 <groupId>org.slf4j</groupId> 123 <artifactId>slf4j-api</artifactId> 124 <version>1.6.6</version> 125 </dependency> 126 <dependency> 127 <groupId>org.slf4j</groupId> 128 <artifactId>jcl-over-slf4j</artifactId> 129 <version>1.6.6</version> 130 <scope>runtime</scope> 131 </dependency> 132 <dependency> 133 <groupId>org.slf4j</groupId> 134 <artifactId>slf4j-log4j12</artifactId> 135 <version>1.6.6</version> 136 <scope>runtime</scope> 137 </dependency> 138 139 </dependencies> 140 141 <!-- 功能集標籤,在此標籤下面能夠定義一系列的插件以實現功能 142 主要用於編譯設置,通常包含兩種標籤:resource和plugins,前者用於排除或包含某些資源文件,後者用來設置插件。 143 例如:在用Junit4寫測試程序,用到了@test等註解, 144 可是因爲Maven的核心插件之一compiler插件默認只支持編譯java1.3,所以須要配置該插件使其支持java5,須要修改pom文件以下: 145 --> 146 <build> 147 <finalName>TestSM</finalName><!-- 當前項目的 <artifactId>標示--> 148 <!-- Maven的編譯插件默認是JDK 1.4的編譯級別,爲了讓Maven的編譯插件使用JDK5.0的編譯級別,須要對編譯插件做以下配置 --> 149 <plugins> 150 <plugin> 151 <groupId>org.apache.maven.plugins</groupId> 152 <artifactId>maven-compiler-plugin</artifactId> 153 <version>2.0</version> 154 <configuration> 155 <source>1.5</source> 156 <target>1.5</target> 157 </configuration> 158 </plugin> 159 </plugins> 160 </build> 161 </project>