<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">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.geoway.zbph</groupId>
	<artifactId>ns-zbph-server</artifactId>
	<version>2.5-rc</version>
	<packaging>jar</packaging>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.2.13.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<package.path>${project.basedir}/../../OUT/zbph</package.path>
		<skipTests>true</skipTests>
		<!-- 指定 Tomcat 版本 -->
		<tomcat.version>9.0.106</tomcat.version> <!-- Tomcat 9 最新稳定版 -->
	</properties>
	
	<dependencies>


		<dependency>
			<groupId>com.geoway.zbph</groupId>
			<artifactId>ns-zbph-api</artifactId>
			<version>${project.version}</version>
		</dependency>
		<!--<dependency>
			<groupId>com.geoway.ai</groupId>
			<artifactId>ns-ai-base</artifactId>
			<version>0.9-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>com.geoway.ai</groupId>
			<artifactId>ns-ai-chat</artifactId>
			<version>0.9-SNAPSHOT</version>
		</dependency>-->

	</dependencies>

	<build>
		<finalName>zbph</finalName>
		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.2.1</version>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>verify</phase>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>2.5</version>
				<executions>
					<execution>
						<id>auto-clean</id>
						<phase>initialize</phase>
						<goals>
							<goal>clean</goal>
						</goals>
						<configuration>
							<skip>false</skip>
							<filesets>
								<fileset>
									<directory>${package.path}</directory>
								</fileset>
							</filesets>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<includes>
						<include>
							<groupId>nothing</groupId>
							<artifactId>nothing</artifactId>
						</include>
					</includes>
					<outputDirectory>${package.path}</outputDirectory>
					<includeSystemScope>true</includeSystemScope>
					<!--                    <skip>true</skip>-->
					<fork>true</fork> <!--重要 devtools-->
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.1.2</version>
				<executions>
					<execution>
						<id>unpack</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${package.path}/mlib</outputDirectory>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
							<excludeArtifactIds>geoway-base,geoway-metadata,ns-zbph-biz,ns-zbph-sys,ns-zbph-api,ns-zbph-scheduler</excludeArtifactIds>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.1.2</version>
				<executions>
					<execution>
						<id>unpack2</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${package.path}/glib</outputDirectory>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
							<includeArtifactIds>geoway-base,geoway-metadata,ns-zbph-biz,ns-zbph-sys,ns-zbph-api,ns-zbph-scheduler</includeArtifactIds>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>src/main/resources</directory>
									<includes>
										<include>**/**.properties</include>
									</includes>
									<excludes>
										<exlude>kaptcha.properties</exlude>
									</excludes>
								</resource>
							</resources>
							<outputDirectory>${package.path}/config</outputDirectory>
						</configuration>
					</execution>

					<!--copy 脚本，把bin目录下的文件复制到，打包目录下-->
					<execution>
						<id>copy-bin</id>
						<phase>package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>${project.basedir}/../config/bins/</directory>
									<includes>
										<include>*zbph.bat*</include>
										<include>*zbph.sh*</include>
									</includes>
								</resource>
							</resources>
							<outputDirectory>${package.path}</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>com.coderplus.maven.plugins</groupId>
				<artifactId>copy-rename-maven-plugin</artifactId>
				<version>1.0.1</version>
				<executions>
					<execution>
						<id>rename-bat</id>
						<phase>package</phase>
						<goals>
							<goal>rename</goal>
						</goals>
						<configuration>
							<sourceFile>${package.path}/start-zbph.bats</sourceFile>
							<destinationFile>${package.path}/start-zbph.bat</destinationFile>
						</configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>



	</build>
	<distributionManagement>
		<repository>
			<id>releases</id>
			<name>Release Repository</name>
			<url>http://atlas.geoway.com.cn:8005/nexus/repository/maven-releases</url>
		</repository>
		<snapshotRepository>
			<id>snapshots</id>
			<url>http://atlas.geoway.com.cn:8005/nexus/repository/maven-snapshots/</url>
		</snapshotRepository>
	</distributionManagement>
</project>