<?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指定为spring boot，解决打包的问题-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.5.9</version>
        <relativePath/>
    </parent>

    <groupId>com.freelancer</groupId>
    <artifactId>framework-parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <!-- 构件执行deploy命令时，发布到的目的库,根据版本号是否以-SNAPSHOT结束来判断 -->
    <distributionManagement>
        <!-- 项目正式库 -->
        <repository>
            <id>nexus-releases</id>
            <name>nexus-releases</name>
            <url>http://maven.bxmdev.com/nexus/content/repositories/releases/</url>
        </repository>

        <!-- 代码快照版本库（版本号以SNAPSHOT结尾的构件） -->
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <name>nexus-snapshots</name>
            <url>http://maven.bxmdev.com/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>3.5.9</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-scm-plugin</artifactId>
                <version>2.2.1</version>
            </plugin>
            <plugin>
                <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
                <version>1.21.0</version>
                <configuration>
                    <installProject>false</installProject>
                    <verbose>false</verbose>

                    <gitFlowConfig>
                        <productionBranch>master</productionBranch>
                        <developmentBranch>develop</developmentBranch>
                        <featureBranchPrefix>feature/</featureBranchPrefix>
                        <releaseBranchPrefix>release/</releaseBranchPrefix>
                        <hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
                        <supportBranchPrefix>support/</supportBranchPrefix>
                        <origin>origin</origin>
                    </gitFlowConfig>

                    <commitMessages>
                        <featureStartMessage>feature start: ${project.artifactId} : @{version}
                        </featureStartMessage>
                        <featureFinishMessage>feature finish: ${project.artifactId} : @{version}
                        </featureFinishMessage>

                        <hotfixStartMessage>hotfix start : ${project.artifactId} : @{version}</hotfixStartMessage>
                        <hotfixFinishMessage>hotfix finish : ${project.artifactId} : @{version}</hotfixFinishMessage>
                        <hotfixVersionUpdateMessage>hotfix version update : ${project.artifactId}
                        </hotfixVersionUpdateMessage>

                        <releaseStartMessage>release start : ${project.artifactId} : @{version}</releaseStartMessage>
                        <releaseFinishMessage>release finish : ${project.artifactId} : @{version}</releaseFinishMessage>

                        <releaseVersionUpdateMessage>release version update : ${project.artifactId} : @{version}
                        </releaseVersionUpdateMessage>

                        <!-- Default git merge commit message will be used if left empty or undefined. -->
                        <releaseFinishMergeMessage>release finish merge : ${project.artifactId} : @{version}
                        </releaseFinishMergeMessage>

                        <tagHotfixMessage>Tag hotfix</tagHotfixMessage>
                        <tagReleaseMessage>Tag release</tagReleaseMessage>
                    </commitMessages>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.4</version>
                <configuration>
                    <deployAtEnd>true</deployAtEnd>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- 代码发布插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <arguments>-DskipTests</arguments>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.shared</groupId>
                        <artifactId>maven-filtering</artifactId>
                        <version>3.2.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>