<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>de.alpharogroup</groupId>
		<artifactId>address-book-data</artifactId>
		<version>3.12.2</version>
	</parent>

	<artifactId>address-book-init</artifactId>

	<dependencies>

		<dependency>
			<groupId>de.alpharogroup</groupId>
			<artifactId>data-initialization</artifactId>
		</dependency>

		<dependency>
			<groupId>de.alpharogroup</groupId>
			<artifactId>address-book-entities</artifactId>
		</dependency>

		<dependency>
			<groupId>de.alpharogroup</groupId>
			<artifactId>address-book-business</artifactId>
		</dependency>

		<dependency>
			<groupId>de.alpharogroup</groupId>
			<artifactId>address-book-domain</artifactId>
		</dependency>
		<!-- HIBERNATE DEPENDENCIES -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-ehcache</artifactId>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
		</dependency>

		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib</artifactId>
		</dependency>
		<!-- MYSTIC-CRYPT DEPENDENCIES -->
		<dependency>
			<groupId>de.alpharogroup</groupId>
			<artifactId>randomizer</artifactId>
		</dependency>
		<!-- JDBC DEPENDENCIES -->
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
		</dependency>
		<!-- H2 DEPENDENCIES -->
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
		</dependency>
		<!-- CONNECTION-POOL DEPENDENCIES -->
		<dependency>
			<groupId>org.apache.tomcat</groupId>
			<artifactId>tomcat-dbcp</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.tomcat</groupId>
			<artifactId>tomcat-jdbc</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<profiles>

		<profile>
			<id>create-db</id>
			<activation>
				<property>
					<name>performRelease</name>
					<value>true</value>
				</property>
			</activation>

			<build>
				<plugins>

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>properties-maven-plugin</artifactId>
					</plugin>

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>hibernate3-maven-plugin</artifactId>
						<configuration>
							<components>
								<component>
									<name>hbm2ddl</name>
									<implementation>jpaconfiguration</implementation>
								</component>
							</components>
							<componentProperties>
								<drop>true</drop>
								<!-- optional, but useful for later inspection -->
								<outputfilename>schema.ddl</outputfilename>
								<persistenceunit>addressbook</persistenceunit>
							</componentProperties>
						</configuration>
					</plugin>

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>sql-maven-plugin</artifactId>

						<!-- configurations for the jdbc drivers -->
						<configuration>
							<driver>${jdbc.driver}</driver>
							<url>${jdbc.base.url}${jdbc.db.name}</url>
							<username>${jdbc.user}</username>
							<password>${jdbc.password}</password>
						</configuration>
					</plugin>

					<!--This plugin is used to execute java classes with a main method. -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>java</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<mainClass>de.alpharogroup.db.init.InitializeDatabase</mainClass>
							<arguments>
								<argument>delete</argument>
							</arguments>
						</configuration>
					</plugin>

				</plugins>

			</build>

		</profile>

		<profile>
			<id>create-empty-db</id>
			<activation>
				<property>
					<name>performRelease</name>
					<value>true</value>
				</property>
			</activation>

			<build>
				<plugins>

					<!--This plugin is used to execute java classes with a main method. -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<phase>compile</phase>
								<goals>
									<goal>java</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<mainClass>de.alpharogroup.db.init.InitializeDatabase</mainClass>
							<arguments>
								<argument>create-empty</argument>
							</arguments>
						</configuration>
					</plugin>

				</plugins>

			</build>

		</profile>

	</profiles>

</project>