<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>
	<parent>
		<groupId>de.invesdwin</groupId>
		<artifactId>invesdwin-context-persistence-parent</artifactId>
		<version>1.0.3-SNAPSHOT</version>
	</parent>
	<artifactId>invesdwin-context-persistence-jpa</artifactId>
	<packaging>jar</packaging>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<excludes>
						<!-- disabled, actual testing is done in submodules -->
						<exclude>**/*</exclude>
					</excludes>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>de.invesdwin</groupId>
			<artifactId>invesdwin-context</artifactId>
		</dependency>
		<dependency>
			<groupId>de.invesdwin</groupId>
			<artifactId>invesdwin-context-integration</artifactId>
		</dependency>

		<dependency>
			<groupId>com.querydsl</groupId>
			<artifactId>querydsl-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-commons</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-jpamodelgen</artifactId>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<!-- dependant modules need to reference this themselves if they want 
				to use hikaricp -->
			<groupId>com.zaxxer</groupId>
			<artifactId>HikariCP</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<!-- dependant modules need to reference this themselves if they want 
				to use c3p0 -->
			<groupId>com.mchange</groupId>
			<artifactId>c3p0</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<!-- dependant modules need to reference this themselves if they want 
				to use statement logging -->
			<groupId>p6spy</groupId>
			<artifactId>p6spy</artifactId>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<!-- call with: mvn -Preset-database-schema process-resources -->
			<id>reset-database-schema</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<phase>process-resources</phase>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<target>
								<input message="Please specify the schema that should be reset:" addproperty="schema.name" defaultvalue="invesdwin" />
								<property file="src/main/java/META-INF/env/${user.name}.properties" />
								<property file="src/main/java/META-INF/de.invesdwin.context.persistence.jpa.properties" />
								<ac:if xmlns:ac="antlib:net.sf.antcontrib">
									<isset property="schema.name" />
									<then>
										<sql driver="${de.invesdwin.context.persistence.jpa.PersistenceUnitContext.CONNECTION_DRIVER@default_pu}" url="${de.invesdwin.context.persistence.jpa.PersistenceUnitContext.CONNECTION_URL@default_pu}" userid="${de.invesdwin.context.persistence.jpa.PersistenceUnitContext.CONNECTION_USER@default_pu}" password="${de.invesdwin.context.persistence.jpa.PersistenceUnitContext.CONNECTION_PASSWORD@default_pu}">
											<classpath refid="maven.test.classpath" />
											<transaction>
												drop database ${schema.name};
												create database
												${schema.name};
											</transaction>
										</sql>
									</then>
								</ac:if>
							</target>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
