<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--1.組織辨別(包名)-->
<groupId>com.study</groupId>
<!--構件名稱-->
<artifactId>service-study-parent</artifactId>
<!--版本号 這裡直接引用properties屬性-->
<version>${project.version}</version>
<!--2.打包類型 包括jar、war、pom、maven-plugin-->
<packaging>pom</packaging>
<!--項目的描述名。一般産生項目文檔時候才會使用-->
<name>service-study-parent</name>
<!--項目描述-->
<description>service-study project for Spring Boot</description>
<!--繼承父pom-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<!--relativePath給出父項目相對于子項目的路徑,這樣在構件子項目時首先從該相對路徑查找父項目,如果沒有才會從本地庫或進而遠端庫中查找父項目-->
<relativePath>path</relativePath>
</parent>
<!--子產品聚合-->
<modules>
<!--module的值是一個以目前POM**為主目錄的相對路徑。-->
<module>service-study-service</module>
<module>service-study-support</module>
</modules>
<!-- 為pom定義一些常量,在pom中的其它地方可以直接引用 使用方式 如下 :${file.encoding} -->
<properties>
<project.version>1.5.5</project.version>
<java.version>1.8</java.version>
</properties>
<!--項目依賴-->
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8.0</version>
<!--依賴範圍-->
<scope>system</scope>
<!--系統依賴路徑-->
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
<!--設定指依賴是否可選,預設為false,即子項目預設都繼承:為true,否則子項目必需顯示的引入-->
<optional>true</optional>
</dependency>
<!-- SpringBoot依賴 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<!--沒有指定verison,因為在父pom中使用了dependencyManagement來管理子類的版本-->
<!---屏蔽依賴關系-->
<exclusions>
<!--屏蔽依賴關系。 比如項目中使用的libA依賴某個庫的1.0版,libB依賴某個庫的2.0版,
現在想統一使用2.0版,就應該屏蔽掉對1.0版的依賴 -->
<exclusion>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<!--提供了一種管理依賴版本号的方式,隻是聲明依賴,并不實作引入,是以子項目需要顯式的聲明需要用的依賴
用于幫助管理chidren的dependencies,優點就是可以集中管理版本。-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.SR4</version>
<!--parent子產品中,dependencyManagement中預定義太多的依賴,避免造成pom檔案過長
在需要使用到這些依賴的子model中,使用dependencyManagement管理依賴,并import scope依賴
注意:scope=import隻能用在dependencyManagement裡面,且僅用于type=pom的dependency-->
<type>pom</type>
<!---->
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!--用類似于denpendencyManagement,隻是denpendencyManagement是用于管理項目jar包依賴,pluginManagement是用于管理plugin
與pom build裡的plugins差別是,這裡的plugin是列出來,然後讓子pom來決定是否引用-->
<!--主要定義插件的共同元素、擴充元素集合,類似于dependencyManagement, -->
<!--所有繼承于此項目的子項目都能使用。該插件配置項直到被引用時才會被解析或綁定到生命周期。 -->
<!--給定插件的任何本地配置都會覆寫這裡的配置 -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>pre-process-classes</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>pre-process</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<!--建構行為提供支援-->
<build>
<finalName>study-server</finalName>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<!--與pom基礎的dependencies的結構和功能都相同,隻是plugin的dependencies用于plugin,而pom的denpendencies用于項目本身-->
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>
<!--在建構生命周期中執行一組目标的配置。每個目标可能有不同的配置-->
<executions>
<execution>
<!--執行目标的辨別符-->
<id>Generate MyBatis Artifacts</id>
<!--綁定了目标的建構生命周期階段,如果省略,目标會被綁定到源資料裡配置的預設階段-->
<phase>package</phase>
<!--配置的執行目标-->
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<!--作為DOM對象的配置,配置項因插件而異-->
<configuration>
<!--允許移動生成的檔案 -->
<verbose>true</verbose>
<!-- 是否覆寫 -->
<overwrite>true</overwrite>
<!-- 自動生成的配置 -->
<configurationFile>src/main/resources/mybatis-generator.xml</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
<!---發現依賴和擴充的遠端倉庫清單-->
<repositories>
<!--發現依賴和擴充的遠端倉庫清單--->
<repository>
<!--遠端倉庫唯一辨別符。可以用來比對在settings.xml檔案裡配置的遠端倉庫-->
<id>spring-snapshots</id>
<!--遠端倉庫名稱-->
<name>Spring Snapshots</name>
<!--遠端倉庫URL,按protocol://hostname/path形式 -->
<url>https://repo.spring.io/snapshot</url>
<!--如何處理遠端倉庫裡快照版本的下載下傳-->
<snapshots>
<!--可能有人會決定隻為開發目的開啟對快照版本下載下傳的支援-->
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>