<?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.opengauss</groupId>
    <artifactId>observability-instance</artifactId>
    <parent>
        <groupId>org.opengauss</groupId>
        <artifactId>visualtool-parent</artifactId>
        <version>${admin.version}</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
    <properties>
        <nashorn.version>15.3</nashorn.version>
        <velocity.version>2.4.1</velocity.version>
        <!--config-->
        <plugin-id>observability-instance</plugin-id>
        <npm.run.script>buildNoTest</npm.run.script>
        <test.skip>false</test.skip>
        <web.build.skip>false</web.build.skip>
        <build.frontend.skip>false</build.frontend.skip>
		<common-lang3.high.verson>3.18.0</common-lang3.high.verson>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.opengauss</groupId>
            <artifactId>visualtool-framework</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.alibaba</groupId>
                    <artifactId>druid-spring-boot-3-starter</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.baomidou</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.alibaba</groupId>
                    <artifactId>fastjson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.gitee.starblues</groupId>
            <artifactId>spring-brick-bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>com.gitee.starblues</groupId>
            <artifactId>spring-brick-maven-packager</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-extension</artifactId>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-jsqlparser</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-3-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity-engine-core</artifactId>
            <version>${velocity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.opengauss</groupId>
            <artifactId>opengauss-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.intarkDB</groupId>
            <artifactId>intarkDB-jdbc</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/../../lib/intarkdb-jdbc-1.0.0.1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.opengauss.tool</groupId>
            <artifactId>visualtool-common-cipher</artifactId>
        </dependency>
        <dependency>
            <groupId>org.opengauss</groupId>
            <artifactId>third-party-tools</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.mwiede</groupId>
            <artifactId>jsch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.sshd</groupId>
            <artifactId>sshd-sftp</artifactId>
            <version>${sshd.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.nashorn</groupId>
            <artifactId>nashorn-core</artifactId>
            <version>${nashorn.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
        </dependency>
		<dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
			<version>${common-lang3.high.verson}</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>gitee-eb-repo</id>
            <name>The Maven Repository on Gitee</name>
            <url>
                https://gitee.com/agile-adept-team/spring-brick-eb/tree/master/maven-repo
            </url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>gitee-eb-repo</id>
            <name>The Maven Repository on Gitee</name>
            <url>
                https://gitee.com/agile-adept-team/spring-brick-eb/tree/master/maven-repo
            </url>
        </pluginRepository>
    </pluginRepositories>
    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <spring.profiles.active>dev</spring.profiles.active>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.opengauss</groupId>
                    <artifactId>visualtool-framework</artifactId>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>web-ui/dist</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                        <fileset>
                            <directory>${basedir}/src/main/resources/resources</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                    <skip>${web.build.skip}</skip>
                    <failOnError>true</failOnError>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec-maven-plugin.version}</version>
                <configuration>
                    <skip>${build.frontend.skip}</skip>
                    <environmentVariables>
                        <npm_config_cache>${npm.cache}/observability_instance</npm_config_cache>
                    </environmentVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>exec-InstanceExporter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <executable>mvn</executable>
                            <workingDirectory>InstanceExporter</workingDirectory>
                            <arguments>
                                <argument>clean</argument>
                                <argument>package</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>exec-npm-install</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>web-ui</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>exec-npm-run-build</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${web.build.skip}</skip>
                            <executable>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>${npm.run.script}</argument>
                            </arguments>
                            <workingDirectory>web-ui</workingDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <delimiters>@</delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-file-to-classes</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>InstanceExporter/target</directory>
                                    <includes>
                                        <include>*.jar</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-web</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/src/main/resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>web-ui/dist</directory>
                                    <targetPath>resources</targetPath>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.gitee.starblues</groupId>
                <artifactId>spring-brick-maven-packager</artifactId>
                <version>${spring-brick.version}</version>
                <configuration>
                    <mode>prod</mode>
                    <pluginInfo>
                        <id>${plugin-id}</id>
                        <bootstrapClass>
                            com.nctigba.observability.instance.ObservabilityPluginApplication
                        </bootstrapClass>
                        <version>${project.version}</version>
                        <provider>ncti-gba</provider>
                        <description>实例监控插件</description>
                    </pluginInfo>
                    <loadMainResourcePattern>
                        <includes>
                            <include>org.intarkdb.**</include>
                        </includes>
                    </loadMainResourcePattern>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>${test.skip}</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>