<?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>
	<parent>
		<!-- Your own application should inherit from spring-boot-starter-parent -->
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-samples</artifactId>
		<version>2.0.0.BUILD-SNAPSHOT</version>
	</parent>
	<artifactId>spring-boot-sample-jooq</artifactId>
	<name>Spring Boot jOOQ Sample</name>
	<description>Spring Boot jOOQ Sample</description>
	<url>http://projects.spring.io/spring-boot/</url>
	<organization>
		<name>Pivotal Software, Inc.</name>
		<url>http://www.spring.io</url>
	</organization>
	<properties>
		<main.basedir>${basedir}/../..</main.basedir>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jooq</artifactId>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jooq</groupId>
			<artifactId>jooq-codegen</artifactId>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>gensrc/main/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<!--This plugin's configuration is used to store Eclipse m2e settings
					only. It has no influence on the Maven build itself. -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.jooq</groupId>
										<artifactId>
											jooq-codegen-maven
										</artifactId>
										<versionRange>
											[3.6.2,)
										</versionRange>
										<goals>
											<goal>generate</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	<profiles>
		<profile>
			<id>generate</id>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-compiler-plugin</artifactId>
						<executions>
							<execution>
								<id>generate-jooq-utils</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>compile</goal>
								</goals>
								<inherited>false</inherited>
								<configuration>
									<includes>
										<inclue>sample/jooq/util/**</inclue>
									</includes>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>sql-maven-plugin</artifactId>
						<version>1.5</version>
						<executions>
							<execution>
								<phase>generate-sources</phase>
								<goals>
									<goal>execute</goal>
								</goals>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>com.h2database</groupId>
								<artifactId>h2</artifactId>
								<version>${h2.version}</version>
							</dependency>
						</dependencies>
						<configuration>
							<driver>org.h2.Driver</driver>
							<url>jdbc:h2:~/springbootjooq</url>
							<srcFiles>
								<srcFile>${basedir}/src/main/resources/reset.sql</srcFile>
								<srcFile>${basedir}/src/main/resources/schema.sql</srcFile>
							</srcFiles>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.jooq</groupId>
						<artifactId>jooq-codegen-maven</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>generate</goal>
								</goals>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>com.h2database</groupId>
								<artifactId>h2</artifactId>
								<version>${h2.version}</version>
							</dependency>
						</dependencies>
						<configuration>
							<jdbc>
								<driver>org.h2.Driver</driver>
								<url>jdbc:h2:~/springbootjooq</url>
							</jdbc>
							<generator>
								<name>org.jooq.util.DefaultGenerator</name>
								<database>
									<name>org.jooq.util.h2.H2Database</name>
									<includes>.*</includes>
									<excludes />
									<inputSchema>PUBLIC</inputSchema>
								</database>
								<strategy>
									<name>sample.jooq.util.TangleFreeGeneratorStrategy</name>
								</strategy>
								<target>
									<packageName>sample.jooq.domain</packageName>
									<directory>${basedir}/gensrc/main/java</directory>
								</target>
								<generate>
									<records>false</records>
								</generate>
							</generator>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
