<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>com.xuxueli</groupId>
		<artifactId>integrated-job</artifactId>
		<version>2.3.0</version>
	</parent>
	<artifactId>job-admin</artifactId>
	<packaging>jar</packaging>
	<dependencies>

		<!-- starter-web：spring-webmvc + autoconfigure + logback + yaml + tomcat -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		
		<!-- starter-test：junit + spring-test + mockito -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<version>${junit-jupiter.version}</version>
			<scope>test</scope>
		</dependency>
				
		<!-- freemarker-starter -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-freemarker</artifactId>
		</dependency>

		<!-- mail-starter -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-mail</artifactId>
		</dependency>

		<!-- starter-actuator -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

		<!-- mybatis-starter：mybatis + mybatis-spring + hikari（default） -->
		<dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>${mybatis-spring-boot-starter.version}</version>
		</dependency>
		<!-- mysql -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<!-- <version>${mysql-connector-java.version}</version> -->
		</dependency>

		<!-- xxl-job-core -->
		<dependency>
			<groupId>com.xuxueli</groupId>
			<artifactId>job-core</artifactId>
			<version>${project.parent.version}</version>
			<exclusions>
				<exclusion>
					<artifactId>javassist</artifactId>
					<groupId>org.javassist</groupId>
				</exclusion>
				<exclusion>
					<artifactId>poi-ooxml-schemas</artifactId>
					<groupId>org.apache.poi</groupId>
				</exclusion>
				<exclusion>
					<artifactId>mybatis</artifactId>
					<groupId>org.mybatis</groupId>
				</exclusion>
				<exclusion>
					<artifactId>poi</artifactId>
					<groupId>org.apache.poi</groupId>
				</exclusion>
				<exclusion>
					<artifactId>commons-logging</artifactId>
					<groupId>commons-logging</groupId>
				</exclusion>
				<exclusion>
					<artifactId>poi-ooxml</artifactId>
					<groupId>org.apache.poi</groupId>
				</exclusion>
			</exclusions>
		</dependency>

		<!--  knife4j for swagger -->
		<!--<dependency>
			<groupId>com.github.xiaoymin</groupId>
			<artifactId>knife4j-spring-boot-starter</artifactId>
			<version>${knife4j-spring-boot-starter.version}</version>
		</dependency>-->
		
	</dependencies>

	<properties>
		<docker.registry>labisenlin.persagy.com</docker.registry>
		<docker.plugin.version>0.32.0</docker.plugin.version>
		<docker.username>admin</docker.username>
		<docker.password>1qaz@WSX</docker.password>
		<docker.namespace>integrated-public</docker.namespace>
		<docker.host>http://192.168.52.100:2375</docker.host>
		<docker.tcp.host>tcp://192.168.52.100:2375</docker.tcp.host>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<!-- docker -->
			<!--<plugin>
				<groupId>com.spotify</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<version>0.4.13</version>
				<configuration>
					&lt;!&ndash; made of '[a-z0-9-_.]' &ndash;&gt;
					<imageName>${project.artifactId}:${project.version}</imageName>
					<dockerDirectory>${project.basedir}</dockerDirectory>
					<resources>
						<resource>
							<targetPath>/</targetPath>
							<directory>${project.build.directory}</directory>
							<include>${project.build.finalName}.jar</include>
						</resource>
					</resources>
				</configuration>
			</plugin>-->
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<version>${docker.plugin.version}</version>
				<!--全局配置-->
				<configuration>
					<!--这一部分是为了实现对远程docker容器的控制-->
					<!--docker主机地址,用于完成docker各项功能,注意是tcp不是http!-->
					<dockerHost>${docker.tcp.host}</dockerHost>
					<!--docker远程访问所需证书地址,如果docker远程主机没有启用TLS验证则不需要配证书-->
					<certPath>${project.basedir}/docker/ssh</certPath>
					<!--这一部分是为了实现docker镜像的构建和推送-->
					<!--registry地址,用于推送,拉取镜像,我这里用的是阿里的registry-->
					<registry>${docker.registry}</registry>
					<!--认证配置,用于私有registry认证,如果忘记了可以去阿里的registry查看-->
					<authConfig>
						<push>
							<username>${docker.username}</username>
							<password>${docker.password}</password>
						</push>
					</authConfig>

					<!--镜像相关配置,支持多镜像-->
					<images>
						<!-- 单个镜像配置 -->
						<image>
							<!--镜像名(含版本号)-->
							<name>${docker.registry}/${docker.namespace}/${project.name}:${project.version}</name>
							<!--别名:用于容器命名和在docker-compose.yml文件只能找到对应名字的配置-->
							<alias>${project.name}</alias>
							<!--<copy>
								<entries>
									<entry>
										&lt;!&ndash; The container directory to copy &ndash;&gt;
										<containerPath>/mnt/integrated/job-admin/app.jar</containerPath>
										<hostDirectory>${project.basedir}/target/*.jar</hostDirectory>
									</entry>
								</entries>
							</copy>-->
							<!--镜像build相关配置-->
							<build>
								<!--使用dockerFile文件-->
								<dockerFile>${project.basedir}/Dockerfile</dockerFile>
								<!--<from>registry.persagy.com/base/centos:v-jdk1.8</from>
								<workdir>/mnt/integrated/job-admin</workdir>
								<env>
									<TZ>Asia/Shanghai</TZ>
									<WORKER_HOME>/mnt/integrated/job-admin</WORKER_HOME>
								</env>
								<labels>
									<tier>backend</tier>
									<product>integrated</product>
									<project>job-admin</project>
									<name>job-admin</name>
								</labels>
								<runCmds>
									<run>ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime</run>
									<run>echo 'Asia/Shanghai' > /etc/timezone</run>
									<run>mkdir -p $WORKER_HOME/config</run>
								</runCmds>
								&lt;!&ndash;相当于Dockerfile中的entryPoint &ndash;&gt;
								<entryPoint>
									<exec>
										<arg>java</arg>
										<arg>-jar</arg>
										<arg>$JAVA_OPTS</arg>
										<arg>-Dfile.encoding=UTF-8</arg>
										<arg>-Dconsole.encoding=UTF-8</arg>
										<arg>-Dserver.port=$SERVER_PORT</arg>
										<arg>app.jar</arg>
									</exec>
								</entryPoint>
                                <assembly>
                                    &lt;!&ndash;生成的模式，默认为dir&ndash;&gt;
                                    <mode>dir</mode>
                                    &lt;!&ndash;输出的目录，在镜像容器中的位置及编译生成的jar文件名称&ndash;&gt;
                                    <targetDir>$WORKER_HOME/app.jar</targetDir>
                                    &lt;!&ndash;&ndash;&gt;
                                    <descriptorRef>project</descriptorRef>
                                </assembly>-->
							</build>
						</image>
					</images>
				</configuration>
				<dependencies>
					<!--该插件需要这个依赖-->
					<dependency>
						<groupId>commons-codec</groupId>
						<artifactId>commons-codec</artifactId>
						<version>1.11</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>

</project>
