<?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>hello.world</groupId>
	<artifactId>world</artifactId>
	<name>Servlet</name>
	<packaging>war</packaging>
	<version>1.0.0-BUILD-SNAPSHOT</version>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>11</maven.compiler.target>
		<cache2k-version>1.2.3.Final</cache2k-version>
		<jackson-version>2.10.0.pr1</jackson-version>
		<!-- This is the default web.xml for plaintext and json only -->
		<maven.war.xml>src/main/webapp/WEB-INF/web.xml</maven.war.xml>
	</properties>

	<dependencies>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>${jackson-version}</version>
		</dependency>

		<!-- Turn off to use the implementation provided from Resin
		<dependency>
			<groupId>org.apache.taglibs</groupId>
			<artifactId>taglibs-standard-impl</artifactId>
			<version>1.2.5</version>
		</dependency>
		-->

		<!-- @Inject -->
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
		</dependency>

		<dependency>
			<groupId>javax.annotation</groupId>
			<artifactId>javax.annotation-api</artifactId>
			<version>1.3.2</version>
		</dependency>

		<!-- Servlet -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>

		<!-- cache2k -->
		<dependency>
			<groupId>org.cache2k</groupId>
			<artifactId>cache2k-base-bom</artifactId>
			<version>${cache2k-version}</version>
			<type>pom</type>	
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>mysql</id>
			<properties>
				<maven.war.xml>src/main/resources/WEB-INF/mysql/web.xml</maven.war.xml>
			</properties>
			<dependencies>
				<dependency>
					<groupId>mysql</groupId>
					<artifactId>mysql-connector-java</artifactId>
					<version>8.0.18</version>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-war-plugin</artifactId>
						<configuration>
							<webResources>
								<resource>
									<directory>src/main/resources/WEB-INF/mysql</directory>
									<includes>
										<include>resin-web.xml</include>
									</includes>
									<excludes>
										<exclude>src/main/resources/WEB-INF/</exclude>
									</excludes>
									<targetPath>WEB-INF</targetPath>
								</resource>
							</webResources>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>postgresql</id>
			<properties>
				<maven.war.xml>src/main/resources/WEB-INF/postgresql/web.xml</maven.war.xml>
			</properties>
			<dependencies>
				<dependency>
					<groupId>org.postgresql</groupId>
					<artifactId>postgresql</artifactId>
					<version>42.2.5</version>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-war-plugin</artifactId>
						<configuration>
							<webResources>
								<resource>
									<directory>src/main/resources/WEB-INF/postgresql</directory>
									<includes>
										<include>resin-web.xml</include>
									</includes>
									<excludes>
										<exclude>src/main/resources/WEB-INF/</exclude>
									</excludes>
									<targetPath>WEB-INF</targetPath>
								</resource>
							</webResources>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.0</version>
				<configuration>
					<debug>false</debug>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.1.0</version>
				<configuration>
					<warName>servlet</warName>
					<!-- Use the web.xml from the current profile -->
					<webXml>${maven.war.xml}</webXml>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>
