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

    <groupId>org.sky</groupId>
    <artifactId>Kd-Cloud</artifactId>
    <version>${revision}</version>
    <packaging>pom</packaging>

    <properties>
        <revision>2.0.7.RELEASE</revision>

        <java.version>8</java.version>
        <maven.plugin.version>3.11.0</maven.plugin.version>
        <maven.flatten.version>1.3.0</maven.flatten.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Docker仓库服务配置 -->
        <docker.registry.url>192.168.0.188</docker.registry.url>
        <docker.username>admin</docker.username>
        <docker.password>admin12345</docker.password>
        <docker.namespace>kd</docker.namespace>
        <docker.fabric.skip>false</docker.fabric.skip>
        <docker.fabric.version>0.42.0</docker.fabric.version>
    </properties>

    <modules>
        <module>kd-common</module>
        <module>kd-auth</module>
        <module>kd-gateway</module>
        <module>kd-ops</module>
        <module>kd-ops-api</module>
        <module>kd-service</module>
        <module>kd-service-api</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.sky.platform</groupId>
                <artifactId>kd-bom</artifactId>
                <version>${revision}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-common</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-scientific</artifactId>
                <version>${revision}</version>
            </dependency>
             <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-dict-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-scope-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-desk-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-resource-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-user-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-flow-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-system-api</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>org.sky</groupId>
                <artifactId>kd-scientific-api</artifactId>
                <version>${revision}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!--lombok-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.name}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>3.2.10</version>
                    <configuration>
                        <finalName>${project.build.finalName}</finalName>
                        <excludes>
                            <!-- 打包的 jar 中排除 lombok -->
                            <exclude>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                            </exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>${docker.fabric.version}</version>
                    <configuration>
                        <skip>true</skip>
                        <authConfig>
                            <username>${docker.username}</username>
                            <password>${docker.password}</password>
                        </authConfig>
                        <registry>${docker.registry.url}</registry>
                        <images>
                            <image>
                                <name>${docker.namespace}/${project.build.finalName}:${project.version}</name>
                                <alias>${project.name}</alias>
                                <build>
                                    <dockerFile>${project.basedir}/Dockerfile</dockerFile>
                                </build>
                            </image>
                        </images>
                        <buildArgs>
                            <JAR_FILE>${basedir}/target/${project.build.finalName}.jar</JAR_FILE>
                        </buildArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <target>
                                    <!--suppress UnresolvedMavenProperty -->
                                    <copy overwrite="true"
                                          todir="${project.root.directory}/target"
                                          file="${project.build.directory}/${project.artifactId}.jar"/>
                                </target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>UTF-8</encoding>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>${maven.flatten.version}</version>
                <configuration>
                    <updatePomFile>true</updatePomFile>
                    <flattenMode>oss</flattenMode>
                    <pomElements>
                        <url>remove</url>
                        <scm>remove</scm>
                        <developers>remove</developers>
                        <properties>remove</properties>
                        <repositories>remove</repositories>
                        <distributionManagement>remove</distributionManagement>
                    </pomElements>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten.clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.commonjava.maven.plugins</groupId>
                <artifactId>directory-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>directories</id>
                        <goals>
                            <goal>highest-basedir</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <property>project.root.directory</property>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>16</source>
                    <target>16</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>aliyun-repos</id>
            <name>Aliyun Public Repository</name>
            <url>https://maven.aliyun.com/repository/public</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>2539567-release-mLPVzn</id>
            <name>Kd Release Repository</name>
            <url>https://packages.aliyun.com/682a8930a06d934b0140756f/maven/2539567-release-mlpvzn</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>aliyun-plugin</id>
            <name>Aliyun Public Plugin</name>
            <url>https://maven.aliyun.com/repository/public</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <repository>
            <id>2539567-release-mLPVzn</id>
            <name>Kd Release Repository</name>
            <url>https://packages.aliyun.com/682a8930a06d934b0140756f/maven/2539567-release-mlpvzn</url>
        </repository>
        <snapshotRepository>
            <id>2539567-release-mLPVzn</id>
            <name>Kd Release Repository</name>
            <url>https://packages.aliyun.com/682a8930a06d934b0140756f/maven/2539567-release-mlpvzn</url>
        </snapshotRepository>
    </distributionManagement>

</project>
