<?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>org.apache.iotdb</groupId>
        <artifactId>iotdb-core</artifactId>
        <version>2.0.8</version>
    </parent>
    <artifactId>node-commons</artifactId>
    <name>IoTDB: Core: Node Commons</name>
    <description>Common modules of the server and config node</description>
    <properties>
        <commons.it.skip>${commons.test.skip}</commons.it.skip>
        <commons.test.skip>false</commons.test.skip>
        <commons.ut.skip>${commons.test.skip}</commons.ut.skip>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>service-rpc</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tsfile</groupId>
            <artifactId>common</artifactId>
            <version>${tsfile.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>external-service-api</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>udf-api</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>trigger-api</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>pipe-api</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>iotdb-thrift-confignode</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>iotdb-thrift-ainode</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>iotdb-thrift</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>iotdb-thrift-commons</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>iotdb-thrift-consensus</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tsfile</groupId>
            <artifactId>tsfile</artifactId>
            <version>${tsfile.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>metrics-interface</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>metrics-core</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.thrift</groupId>
            <artifactId>libthrift</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>net.minidev</groupId>
            <artifactId>json-smart</artifactId>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>oauth2-oidc-sdk</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.luben</groupId>
            <artifactId>zstd-jni</artifactId>
        </dependency>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.ratis</groupId>
            <artifactId>ratis-common</artifactId>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/assembly/resources/conf</directory>
                <includes>
                    <include>iotdb-system.properties.template</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
            <!--
        Generate an OSGI compatible MANIFEST file.
      -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <exportScr>true</exportScr>
                    <instructions>
                        <_include>-bnd.bnd</_include>
                        <_removeheaders>Bnd-LastModified,Built-By</_removeheaders>
                        <Embed-Dependency>dependencies</Embed-Dependency>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                    <includeOnlyProperties>
                        <includeOnlyProperty>^git.commit.id.abbrev$</includeOnlyProperty>
                        <includeOnlyProperty>^git.dirty$</includeOnlyProperty>
                    </includeOnlyProperties>
                    <commitIdGenerationMode>full</commitIdGenerationMode>
                    <failOnNoGitDirectory>false</failOnNoGitDirectory>
                    <failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
                    <offline>true</offline>
                    <gitDescribe>
                        <dirty>-dev</dirty>
                    </gitDescribe>
                </configuration>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--
              Use the MANIFEST file generated by the maven-bundle-plugin.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifest>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!--using `mvn test` to run UT, `mvn verify` to run ITs
            Reference: https://antoniogoncalves.org/2012/12/13/lets-turn-integration-tests-with-maven-to-a-first-class-citizen/-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>${commons.ut.skip}</skipTests>
                    <reuseForks>false</reuseForks>
                    <runOrder>random</runOrder>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <skipTests>${commons.test.skip}</skipTests>
                    <skipITs>${commons.it.skip}</skipITs>
                    <reuseForks>false</reuseForks>
                    <runOrder>random</runOrder>
                </configuration>
                <executions>
                    <execution>
                        <id>run-integration-tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>skipCommonsTests</id>
            <activation>
                <property>
                    <name>skipTests</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <commons.it.skip>true</commons.it.skip>
                <commons.test.skip>true</commons.test.skip>
                <commons.ut.skip>true</commons.ut.skip>
            </properties>
        </profile>
        <profile>
            <id>skipUT_CommonsTests</id>
            <activation>
                <property>
                    <name>skipUTs</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <commons.ut.skip>true</commons.ut.skip>
            </properties>
        </profile>
        <profile>
            <id>get-jar-with-dependencies</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <!-- bind to the packaging phase -->
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <!-- this is used for inheritance merges -->
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
