<!--
  Copyright 2022 Deep Learning on Flink Authors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<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/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.flinkextended</groupId>
    <artifactId>dl-on-flink</artifactId>
    <name>${project.artifactId}</name>
    <packaging>pom</packaging>
    <version>0.5.0</version>
    <description>This project extends support for AI computing framework on Flink</description>
    <url>https://github.com/alibaba/flink-ai-extended</url>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <organization>
        <name>Flink Extended</name>
        <url>https://github.com/flink-extended</url>
    </organization>
    <scm>
        <url>https://github.com/flink-extended/dl-on-flink</url>
        <connection>scm:git:https://git@github.com:flink-extended/dl-on-flink.git</connection>
    </scm>
    <developers>
        <developer>
            <id>wuchaochen</id>
            <name>wuchaochen</name>
            <email>267411555@qq.com</email>
        </developer>
        <developer>
            <id>Xuannan</id>
            <name>Xuannan Su</name>
            <email>suxuannan95@gmail.com</email>
        </developer>
    </developers>
    <issueManagement>
        <system>github</system>
        <url>https://github.com/flink-extended/dl-on-flink/issues</url>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>oss_id</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>oss_id</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <modules>
        <module>dl-on-flink-framework</module>
        <module>dl-on-flink-operator</module>
        <module>dl-on-flink-tensorflow</module>
        <module>dl-on-flink-tensorflow-2.x</module>
        <module>dl-on-flink-tensorflow-common</module>
        <module>dl-on-flink-pytorch</module>
        <module>dl-on-flink-examples</module>
        <module>dl-on-flink-lib</module>
        <module>dl-on-flink-dist</module>
    </modules>

    <properties>
        <protobuf.version>3.16.1</protobuf.version>
        <flink.version>1.14.0</flink.version>
        <scala.major.version>2.12</scala.major.version>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <grpc.version>1.13.2</grpc.version>
        <log4j.version>2.17.1</log4j.version>
        <hadoop.version>2.10.1</hadoop.version>
        <netty.version>4.1.30.Final</netty.version>
        <curator.version>2.7.1</curator.version>
        <junit.version>4.13.1</junit.version>
        <mockito.version>1.10.19</mockito.version>
        <compiler.version>3.1</compiler.version>
        <compiler.source.version>1.8</compiler.source.version>
        <compiler.target.version>1.8</compiler.target.version>
        <scala.test.version>3.0.5</scala.test.version>
        <spotless.version>2.4.2</spotless.version>
        <flinkml.version>2.0.0</flinkml.version>

        <pip.install.option>--user</pip.install.option>
        <skip.install.py.dep>true</skip.install.py.dep>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>net.java.dev.jna</groupId>
                <artifactId>jna</artifactId>
                <version>4.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-framework</artifactId>
                <version>${curator.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-test</artifactId>
                <version>${curator.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jctools</groupId>
                <artifactId>jctools-core</artifactId>
                <version>2.1.2</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.13</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.2.83</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-netty</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-protobuf</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-stub</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-testing</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-tcnative</artifactId>
                <version>2.0.14.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-tcnative-boringssl-static</artifactId>
                <version>2.0.14.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-common</artifactId>
                <version>${netty.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-transport</artifactId>
                <version>${netty.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-transport-native-epoll</artifactId>
                <version>${netty.version}</version>
                <classifier>linux-x86_64</classifier>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.3.2</version>
            </dependency>
            <dependency>
                <groupId>com.github.oshi</groupId>
                <artifactId>oshi-core</artifactId>
                <version>3.8.2</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest</artifactId>
                <version>2.2</version>
            </dependency>
            <dependency>
                <groupId>net.sourceforge.argparse4j</groupId>
                <artifactId>argparse4j</artifactId>
                <version>0.8.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java-util</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>20.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.hadoop</groupId>
                <artifactId>hadoop-common</artifactId>
                <version>${hadoop.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>commons-cli</artifactId>
                        <groupId>commons-cli</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.hadoop</groupId>
                <artifactId>hadoop-hdfs</artifactId>
                <version>${hadoop.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>commons-cli</artifactId>
                        <groupId>commons-cli</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-model</artifactId>
                <version>3.6.0</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-clients_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-streaming-java_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-streaming-scala_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-table-api-java</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-table-api-java-bridge_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-table-planner_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-table-runtime_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-scala_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-core</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-python_${scala.major.version}</artifactId>
                <version>${flink.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.flink</groupId>
                <artifactId>flink-ml-iteration_${scala.major.version}</artifactId>
                <version>${flinkml.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${scala.major.version}</artifactId>
                <version>${scala.test.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.2.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${compiler.version}</version>
                <configuration>
                    <source>${compiler.source.version}</source>
                    <target>${compiler.target.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
                <configuration>
                    <reuseForks>true</reuseForks>
                    <forkCount>1</forkCount>
                    <forkedProcessTimeoutInSeconds>2400</forkedProcessTimeoutInSeconds>
                    <useSystemClassLoader>false</useSystemClassLoader>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <!-- Note: match version with docs/flinkDev/ide_setup.md -->
                        <version>8.14</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <suppressionsLocation>/tools/maven/suppressions.xml</suppressionsLocation>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <configLocation>/tools/maven/checkstyle.xml</configLocation>
                            <logViolationsToConsole>true</logViolationsToConsole>
                            <failOnViolation>true</failOnViolation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <configuration>
                    <java>
                        <googleJavaFormat>
                            <version>1.7</version>
                            <style>AOSP</style>
                        </googleJavaFormat>

                        <!-- \# refers to the static imports -->
                        <importOrder>
                            <order>
                                org.flinkextended.flink.ml,org.apache.flink,org.apache.flink.shaded,,javax,java,scala,\#
                            </order>
                        </importOrder>

                        <removeUnusedImports/>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <version>0.12</version><!--$NO-MVN-MAN-VER$-->
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludeSubProjects>false</excludeSubProjects>
                    <numUnapprovedLicenses>0</numUnapprovedLicenses>
                    <licenses>
                        <!-- Enforce this license:
                            Copyright 2022 Deep Learning on Flink Authors

                            Licensed under the Apache License, Version 2.0 (the "License");
                            you may not use this file except in compliance with the License.
                            You may obtain a copy of the License at

                                http://www.apache.org/licenses/LICENSE-2.0

                            Unless required by applicable law or agreed to in writing, software
                            distributed under the License is distributed on an "AS IS" BASIS,
                            WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
                            See the License for the specific language governing permissions and
                            limitations under the License.
                        -->
                        <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
                            <licenseFamilyCategory>AL20 </licenseFamilyCategory>
                            <licenseFamilyName>Apache License 2.0</licenseFamilyName>
                            <notes />
                            <patterns>
                                <pattern>Copyright 2022 Deep Learning on Flink Authors</pattern>
                            </patterns>
                        </license>
                    </licenses>
                    <licenseFamilies>
                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
                            <familyName>Apache License 2.0</familyName>
                        </licenseFamily>
                    </licenseFamilies>
                    <addDefaultLicenseMatchers>false</addDefaultLicenseMatchers>
                    <excludes>
                        <exclude>.*/**</exclude>
                        <exclude>**/.*/**</exclude>
                        <exclude>**/*.log</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.csv</exclude>
                        <exclude>**/*.iml</exclude>
                        <exclude>**/*.md</exclude>

                        <exclude>**/*.egg-info/**</exclude>
                        <exclude>**/python/build/**</exclude>
                        <exclude>**/python/lib/**</exclude>

                        <exclude>**/target/**</exclude>
                        <exclude>**/dependency-reduced-pom.xml</exclude>

                        <exclude>docker/flink/sources.list</exclude>
                        <exclude>docker/flink/vimrc</exclude>
                        <exclude>docker/yarn/slaves</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <properties>
                <skip.install.py.dep>false</skip.install.py.dep>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</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-javadoc-plugin</artifactId>
                        <version>2.9.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <show>public</show>
                            <charset>UTF-8</charset>
                            <encoding>UTF-8</encoding>
                            <docencoding>UTF-8</docencoding>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <configuration>
                            <!-- Prevent `gpg` from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>install-py-dep</id>
            <properties>
                <skip.install.py.dep>false</skip.install.py.dep>
            </properties>
        </profile>
    </profiles>
</project>
