1. 程式人生 > >springboot一個例項專案的pom.xml檔案

springboot一個例項專案的pom.xml檔案

開發十年,就只剩下這套架構體系了! >>>   

1、搭建的基礎是公司提供的一個xxx-xxx-web-parent的包,相當於對springboot的parent包的封裝。

<?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>

    <parent>
        <groupId>com.xxx.xxx.xxx</groupId>
        <artifactId>xxx-xxx-web-parent</artifactId>
        <version>1.0.4-SNAPSHOT</version>
        <relativePath></relativePath>
    </parent>

    <groupId>com.xxx.xxx.web.plan</groupId>
    <artifactId>xxx-web-plan</artifactId>
    <version>1.0.0</version>
    <name>xxx-web-plan</name>
    <description>xxx web plan for xxx</description>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyyMMddHHmmssSSS</maven.build.timestamp.format>
        <maven.deploy.skip>true</maven.deploy.skip>
        <xxx-xxx.version>1.0.4-SNAPSHOT</xxx-xxx.version>
        <mysql.version>5.1.46</mysql.version>
        <xxx.xxx>1.1.1</xxx.xxx>
        <lombok.version>1.18.4</lombok.version>
        <powermock.version>1.7.1</powermock.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>${fastjson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
        <dependency>
            <groupId>com.xxx.xxx.xxx</groupId>
            <artifactId>xxx-xxx-data-mybatis</artifactId>
            <version>${xxx-xxx.version}</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>${druid.version}</version>
        </dependency>
        <dependency>
            <groupId>com.xxx.xxx.xxx</groupId>
            <artifactId>xxx-xxx-data-redis</artifactId>
            <version>${xxx-xxx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- 單元測試end -->
        <dependency>
            <groupId>com.xxx.xxx.common</groupId>
            <artifactId>xxx-base-common</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.xxx.xxx.api</groupId>
            <artifactId>xxx-service-api</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- POI檔案匯出 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.9</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun.openservices</groupId>
            <artifactId>ons-client</artifactId>
            <version>1.7.8.Final</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.name}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.xxx.xxx.xxx.plan.PlanWebApplication</mainClass>
                    <layout>ZIP</layout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.2.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--日期格式;預設值:dd.MM.yyyy '@' HH:mm:ss z;-->
                    <dateFormat>yyyyMMddHHmmss</dateFormat>
                    <!--,構建過程中,是否列印詳細資訊;預設值:false;-->
                    <verbose>true</verbose>
                    <!-- ".git"檔案路徑;預設值:${project.basedir}/.git; -->
                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                    <!--若專案打包型別為pom,是否取消構建;預設值:true;-->
                    <skipPoms>false</skipPoms>
                    <!--是否生成"git.properties"檔案;預設值:false;-->
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <!--指定"git.properties"檔案的存放路徑(相對於${project.basedir}的一個路徑);-->
                    <generateGitPropertiesFilename>git.properties</generateGitPropertiesFilename>
                    <!--".git"資料夾未找到時,構建是否失敗;若設定true,則構建失敗;若設定false,則跳過執行該目標;預設值:true;-->
                    <failOnNoGitDirectory>true</failOnNoGitDirectory>

                    <!--git描述配置,可選;由JGit提供實現;-->
                    <gitDescribe>
                        <!--是否生成描述屬性-->
                        <skip>false</skip>
                        <!--提交操作未發現tag時,僅列印提交操作ID,-->
                        <always>false</always>
                        <!--提交操作ID顯式字元長度,最大值為:40;預設值:7;
                            0代表特殊意義;後面有解釋;
                        -->
                        <abbrev>7</abbrev>
                        <!--構建觸發時,程式碼有修改時(即"dirty state"),新增指定字尾;預設值:"";-->
                        <dirty>-dirty</dirty>
                        <forceLongFormat>false</forceLongFormat>
                    </gitDescribe>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.9</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>
                                ${project.build.directory}/coverage-reports/jacoco.exec
                            </destFile>
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>