<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
	license agreements. See the NOTICE file distributed with this work for additional
	information regarding copyright ownership. The ASF licenses this file to
	you 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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>ai.platon</groupId>
        <artifactId>platon</artifactId>
        <version>4.0.1</version>
    </parent>

    <groupId>ai.platon.pulsar</groupId>
    <artifactId>pulsar</artifactId>
    <packaging>pom</packaging>
    <version>2.0.2</version>

    <name>Pulsar RPA</name>
    <description>Scrape Web data at scale completely and accurately with high performance, distributed AI-RPA.</description>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Vincent Zhang</name>
            <email>ivincent.zhang@gmail.com</email>
            <organization>platon.ai</organization>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/platonai/pulsar.git</connection>
        <developerConnection>scm:git:https://github.com/platonai/pulsar.git</developerConnection>
        <url>https://github.com/platonai/pulsar</url>
        <tag>v2.0.2</tag>
    </scm>

    <repositories>
        <repository>
            <id>Central</id>
            <url>https://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>

    <!-- Required by dokka-maven-plugin -->
    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

    <profiles>
        <profile>
            <id>all-modules</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>pulsar-common</module>
                <module>pulsar-persist</module>
                <module>pulsar-third</module>
                <module>pulsar-skeleton</module>
                <module>pulsar-resources</module>
                <module>pulsar-dom</module>
                <module>pulsar-plugins</module>

                <module>pulsar-tools</module>
                <module>pulsar-ql-common</module>
                <module>pulsar-ql</module>

                <module>pulsar-bom</module>

                <module>pulsar-spring-support</module>
                <module>pulsar-rest</module>

                <module>pulsar-tests</module>
                <module>pulsar-all</module>

                <module>pulsar-client</module>
                <module>pulsar-app</module>
            </modules>
        </profile>

        <profile>
            <id>dev-daily</id>
            <modules>
                <module>pulsar-common</module>
                <module>pulsar-persist</module>
                <module>pulsar-third</module>
                <module>pulsar-skeleton</module>
                <module>pulsar-resources</module>
                <module>pulsar-dom</module>

                <module>pulsar-tools</module>
                <module>pulsar-ql</module>

                <module>pulsar-spring-support</module>
                <module>pulsar-rest</module>

                <module>pulsar-app</module>
            </modules>
        </profile>

        <profile>
            <id>dev-plugins</id>

            <modules>
                <module>pulsar-skeleton</module>
                <module>pulsar-plugins</module>
            </modules>
        </profile>

        <profile>
            <id>dev-app</id>
            <modules>
                <module>pulsar-app</module>
            </modules>
        </profile>

        <profile>
            <id>platon-release</id>
            <properties>
                <platon-release-active>true</platon-release-active>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>3.0.0-M5</version>
                        <configuration>
                            <tagNameFormat>v${project.parent.version}</tagNameFormat>
                            <updateBranchVersions>false</updateBranchVersions>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka.version}</version>
                        <executions>
                            <execution>
                                <!-- generate javadoc.jar before package gpg plugin can generate asc for it -->
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>dokka</goal>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>

                            <!-- Set to true to skip dokka task, default: false -->
                            <skip>false</skip>

                            <!-- Default: ${project.artifactId} -->
<!--                            <moduleName>data</moduleName>-->

                            <!-- Default: ${project.basedir}/target/dokka -->
<!--                            <outputDir>${project.basedir}/target/dokka</outputDir>-->



                            <!-- Use default or set to custom path to cache directory to enable package-list caching. -->
                            <!-- When set to default, caches stored in $USER_HOME/.cache/dokka -->
                            <cacheRoot>default</cacheRoot>

                            <!-- List of '.md' files with package and module docs -->
                            <!-- https://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentation -->
<!--                            <includes>-->
<!--                                <include>README.md</include>-->
<!--                                <include>README.md</include>-->
<!--                            </includes>-->

                            <!-- List of sample roots -->
<!--                            <samples>-->
<!--                                <dir>src/test/samples</dir>-->
<!--                            </samples>-->

                            <!-- Used for linking to JDK, default: 11 -->
                            <jdkVersion>11</jdkVersion>

                            <!-- Do not output deprecated members, applies globally, can be overridden by packageOptions -->
                            <skipDeprecated>true</skipDeprecated>
                            <!-- Emit warnings about not documented members, applies globally, also can be overridden by packageOptions -->
                            <reportUndocumented>true</reportUndocumented>
                            <!-- Do not create index pages for empty packages -->
                            <skipEmptyPackages>false</skipEmptyPackages>
                            <includeNonPublic>false</includeNonPublic>

                            <!-- Short form list of sourceRoots, by default, set to ${project.compileSourceRoots} -->
                            <sourceDirectories>
                                <dir>${project.basedir}/src/main/java</dir>
                                <dir>${project.basedir}/src/main/kotlin</dir>
                            </sourceDirectories>

                            <!-- Specifies the location of the project source code on the Web. If provided, Dokka generates "source" links
                                 for each declaration. -->
<!--                            <sourceLinks>-->
<!--                                <link>-->
<!--                                    &lt;!&ndash; Source directory &ndash;&gt;-->
<!--                                    <path>${project.basedir}/src/main/kotlin</path>-->
<!--                                    &lt;!&ndash; URL showing where the source code can be accessed through the web browser &ndash;&gt;-->
<!--                                    <url>https://github.com/cy6erGn0m/vertx3-lang-kotlin/blob/master/src/main/kotlin</url> &lt;!&ndash; //remove src/main/kotlin if you use "./" above &ndash;&gt;-->
<!--                                    &lt;!&ndash;Suffix which is used to append the line number to the URL. Use #L for GitHub &ndash;&gt;-->
<!--                                    <lineSuffix>#L</lineSuffix>-->
<!--                                </link>-->
<!--                            </sourceLinks>-->

                            <!-- Disable linking to online kotlin-stdlib documentation  -->
                            <noStdlibLink>false</noStdlibLink>

                            <!-- Disable linking to online JDK documentation -->
                            <noJdkLink>false</noJdkLink>

                            <!-- Allows linking to documentation of the project's dependencies (generated with Javadoc or Dokka) -->
<!--                            <externalDocumentationLinks>-->
<!--                                <link>-->
<!--                                    &lt;!&ndash; Root URL of the generated documentation to link with. The trailing slash is required! &ndash;&gt;-->
<!--                                    <url>https://example.com/docs/</url>-->
<!--                                    &lt;!&ndash; If package-list file located in non-standard location &ndash;&gt;-->
<!--                                    &lt;!&ndash; <packageListUrl>file:///home/user/localdocs/package-list</packageListUrl> &ndash;&gt;-->
<!--                                </link>-->
<!--                            </externalDocumentationLinks>-->

                            <!-- Allows to customize documentation generation options on a per-package basis -->
                            <perPackageOptions>
                                <packageOptions>
                                    <!-- Will match kotlin and all sub-packages of it -->
<!--                                    <prefix>kotlin</prefix>-->

                                    <!-- All options are optional, default values are below: -->
                                    <skipDeprecated>false</skipDeprecated>
                                    <!-- Emit warnings about not documented members  -->
                                    <reportUndocumented>true</reportUndocumented>
                                    <includeNonPublic>false</includeNonPublic>
                                </packageOptions>
                            </perPackageOptions>

                            <!-- Allows to use any dokka plugin, eg. GFM format   -->
<!--                            <dokkaPlugins>-->
<!--                                <plugin>-->
<!--                                    <groupId>org.jetbrains.dokka</groupId>-->
<!--                                    <artifactId>gfm-plugin</artifactId>-->
<!--                                    <version>${dokka.version}</version>-->
<!--                                </plugin>-->
<!--                            </dokkaPlugins>-->
                        </configuration>
                    </plugin>

                    <!-- Help maven-source-plugin works with kotlin -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.0</version>

                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/kotlin</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>dependency-check</id>
            <build>
                <plugins>
                    <!--
                    It is important to understand that the first time this task is executed it may take 20 minutes or
                    more as it downloads and processes the data from the National Vulnerability Database (NVD) hosted
                    by NIST: https://nvd.nist.gov
                     -->
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>10.0.3</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>platon-deploy</id>
            <properties>
                <platon-deploy-active>true</platon-deploy-active>
            </properties>
            <modules>
                <module>pulsar-common</module>
                <module>pulsar-persist</module>
                <module>pulsar-third</module>
                <module>pulsar-skeleton</module>
                <module>pulsar-resources</module>
                <module>pulsar-dom</module>
                <module>pulsar-plugins</module>

                <module>pulsar-tools</module>
                <module>pulsar-ql-common</module>
                <module>pulsar-ql</module>

                <module>pulsar-bom</module>

                <module>pulsar-spring-support</module>
                <module>pulsar-rest</module>

                <module>pulsar-client</module>
            </modules>

            <build>
                <plugins>
                    <!-- We want to sign the artifact, the POM, and all attached artifacts -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.7.0</version>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                        <extensions>true</extensions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>OS-WIN</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <build>
                <plugins>

                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <defaultGoal>install</defaultGoal>
        <directory>target</directory>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <pluginManagement>
            <plugins>
                <!--  kotlin  -->
                <plugin>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <version>${kotlin.version}</version>
                    <!-- You can set this option to automatically take information about lifecycles -->
                    <extensions>true</extensions>
                    <executions>
                        <execution>
                            <id>compile</id>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <sourceDirs>
                                    <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                    <sourceDir>${project.basedir}/src/main/java</sourceDir>
                                </sourceDirs>
                            </configuration>
                        </execution>
                        <execution>
                            <id>test-compile</id>
                            <goals>
                                <goal>test-compile</goal>
                            </goals>
                            <configuration>
                                <sourceDirs>
                                    <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                                    <sourceDir>${project.basedir}/src/test/java</sourceDir>
                                </sourceDirs>
                            </configuration>
                        </execution>
                    </executions>
                    <!--  Required by spring  -->
                    <dependencies>
                        <dependency>
                            <groupId>org.jetbrains.kotlin</groupId>
                            <artifactId>kotlin-maven-allopen</artifactId>
                            <version>${kotlin.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.jetbrains.kotlin</groupId>
                            <artifactId>kotlin-maven-noarg</artifactId>
                            <version>${kotlin.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <args>
                            <arg>-Xjsr305=strict</arg>
                        </args>
                        <compilerPlugins>
                            <plugin>spring</plugin>
                            <plugin>jpa</plugin>
                            <plugin>all-open</plugin>
                        </compilerPlugins>
                        <pluginOptions>
                            <option>all-open:annotation=javax.persistence.Entity</option>
                            <option>all-open:annotation=javax.persistence.Embeddable</option>
                            <option>all-open:annotation=javax.persistence.MappedSuperclass</option>
                        </pluginOptions>
                        <jvmTarget>${kotlin.compiler.jvmTarget}</jvmTarget>
                    </configuration>
                </plugin>
                <!--  java  -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.maven-compiler-plugin}</version>
                    <executions>
                        <!--  Replacing default-compile as it is treated specially by maven  -->
                        <execution>
                            <id>default-compile</id>
                            <phase>none</phase>
                        </execution>
                        <!--  Replacing default-testCompile as it is treated specially by maven  -->
                        <execution>
                            <id>default-testCompile</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <id>java-compile</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>java-test-compile</id>
                            <phase>test-compile</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <verbose>true</verbose>
                        <fork>true</fork>
                        <source>${javac.src.version}</source>
                        <target>${javac.target.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${version.maven-clean-plugin}</version>
                    <configuration>
                        <filesets>
                            <fileset>
                                <directory>${basedir}/lib</directory>
                                <followSymlinks>false</followSymlinks>
                                <useDefaultExcludes>true</useDefaultExcludes>
                                <includes>
                                    <include>*.*</include>
                                </includes>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${maven-exec-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring-boot.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!--  kotlin plugin should come before maven-compiler-plugin  -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <configuration>
                    <!-- Disable warnings or not -->
                    <nowarn>false</nowarn>
                    <args>
                        <!-- Enable strict mode for JSR-305 annotations -->
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <jvmTarget>${kotlin.compiler.jvmTarget}</jvmTarget>
                </configuration>
            </plugin>
            <!-- NO java code by default, so do NOT include maven-compiler-plugin -->
<!--            <plugin>-->
<!--                <groupId>org.apache.maven.plugins</groupId>-->
<!--                <artifactId>maven-compiler-plugin</artifactId>-->
<!--            </plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>7.0.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

            <!--
            The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of
            an application.
            see https://maven.apache.org/surefire/maven-surefire-plugin/
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.version}</version>
                <configuration>
                    <excludedGroups>SlowTest,IntegrationTest</excludedGroups>
                </configuration>

                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit5.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
            </plugin>

            <!-- Override parent pom's javadoc settings, skip generating javadoc, use kdoc instead -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <!-- Skip maven-deploy-plugin to use nexus-staging-maven-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>

            <!-- pulsar-bom -->
            <dependency>
                <groupId>ai.platon.pulsar</groupId>
                <artifactId>pulsar-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.nibor.autolink</groupId>
                <artifactId>autolink</artifactId>
                <version>${autolink.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-coroutines-core-jvm</artifactId>
            <version>${kotlin.coroutine.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit5</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <version.maven-exec-plugin>3.3.0</version.maven-exec-plugin>

    </properties>

</project>
