<?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-sql-diagnosis</artifactId>
	<parent>
		<groupId>org.opengauss</groupId>
		<artifactId>visualtool-parent</artifactId>
		<version>${admin.version}</version>
		<relativePath>../../pom.xml</relativePath>
	</parent>
	<packaging>jar</packaging>
	<properties>
		<!--config-->
		<plugin-id>observability-sql-diagnosis</plugin-id>
		<npm.run.script>buildNoTest</npm.run.script>
		<test.skip>true</test.skip>
		<web.build.skip>false</web.build.skip>
		<web.clean.skip>false</web.clean.skip>
		<!-- jsqlparser4.4版本为适配com.nctigba.observability.sql.util.PointUtils相关函数,高版本不支持部分函数实现 -->
		<jsqlparser.version>4.4</jsqlparser.version>
		<nashorn-core.version>15.3</nashorn-core.version>
		<es-java-client.version>8.3.3</es-java-client.version>
		<jakarta-json.version>2.1.3</jakarta-json.version>
		<parsson.version>1.0.5</parsson.version>
		<build.frontend.skip>false</build.frontend.skip>
	</properties>
	<dependencies>
		<!-- same as framework -->
		<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>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-websocket</artifactId>
		</dependency>
		<dependency>
			<groupId>com.gitee.starblues</groupId>
			<artifactId>spring-brick-maven-packager</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-inline</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>${lombok.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>fastjson</artifactId>
		</dependency>
		<dependency>
			<groupId>cn.hutool</groupId>
			<artifactId>hutool-all</artifactId>
		</dependency>
		<!-- common -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-log4j2</artifactId>
		</dependency>
		<!-- data -->
		<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>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
			<version>${jakarta-servlet-api.version}</version>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
		</dependency>
		<dependency>
			<groupId>org.opengauss</groupId>
			<artifactId>opengauss-jdbc</artifactId>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.sshd/sshd-scp -->
		<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-core.version}</version>
		</dependency>
		<!-- elastic search java client -->
		<dependency>
			<groupId>co.elastic.clients</groupId>
			<artifactId>elasticsearch-java</artifactId>
			<version>${es-java-client.version}</version>
			<exclusions>
				<exclusion>
					<artifactId>jakarta.json-api</artifactId>
					<groupId>jakarta.json</groupId>
				</exclusion>
				<exclusion>
					<groupId>org.eclipse.parsson</groupId>
					<artifactId>parsson</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.eclipse.parsson</groupId>
			<artifactId>parsson</artifactId>
			<version>${parsson.version}</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
		</dependency>
		<dependency>
			<groupId>jakarta.json</groupId>
			<artifactId>jakarta.json-api</artifactId>
			<version>${jakarta-json.version}</version>
		</dependency>
		<dependency>
			<groupId>org.xerial</groupId>
			<artifactId>sqlite-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>
	</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>
				<profiles.active>dev</profiles.active>
				<swagger.scope>compile</swagger.scope>
			</properties>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
		</profile>
		<profile>
			<id>prod</id>
			<properties>
				<profiles.active>prod</profiles.active>
				<swagger.scope>provided</swagger.scope>
			</properties>
		</profile>
	</profiles>


	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>com.gitee.starblues</groupId>
					<artifactId>spring-brick-maven-packager</artifactId>
					<version>${spring-brick.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${spring-boot.version}</version>
				<configuration>
					<mainClass>com.nctigba.observability.sql.ObservabilityPluginBootApplication</mainClass>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</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.sql.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-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.clean.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_sql_diagnosis</npm_config_cache>
					</environmentVariables>
				</configuration>
				<executions>
					<execution>
						<id>exec-opengauss-ebpf</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>exec</goal>
						</goals>
						<configuration>
							<executable>mvn</executable>
							<workingDirectory>opengauss-ebpf</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-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin.version}</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
					<compilerArgs>
						<arg>-parameters</arg>
					</compilerArgs>
					<annotationProcessorPaths>
						<path>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
							<version>${lombok.version}</version>
						</path>
					</annotationProcessorPaths>
				</configuration>
			</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-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>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>