<?xml version="1.0"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.top-logic</groupId>
		<artifactId>tl-parent-app</artifactId>
		<version>7.6.1</version>
	</parent>

	<artifactId>tl-parent-app-internal</artifactId>

	<description>Parent module for TopLogic applications provided by BOS.</description>

	<organization>
		<name>Business Operation Systems GmbH</name>
		<url>https://www.top-logic.com</url>
	</organization>
	<url>${tl.repository.url}</url>

	<packaging>pom</packaging>
	
	<dependencies>
		<!-- Alternative databases for test. -->

		<!-- 
			Note: Must only be configured by default in internal modules. Otherwise a customer would be required 
			to install all drivers of all supported DBs to start development. 
		-->
		<dependency>
		    <groupId>com.mysql</groupId>
		    <artifactId>mysql-connector-j</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>com.microsoft.sqlserver</groupId>
		    <artifactId>mssql-jdbc</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>com.oracle.database.jdbc</groupId>
		    <artifactId>ojdbc11</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.top-logic</groupId>
			<artifactId>ext-com-ibm-db2</artifactId>
			<type>pom</type>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>org.postgresql</groupId>
		    <artifactId>postgresql</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<!-- Profiles for including a database driver to the final application WAR. -->
		
		<!-- 
			Note: This section must be repeated from the public app parent to be able to override the test 
			dependencies above.
		-->
		<profile>
			<id>with-h2</id>
			
			<properties>
				<tl.app.metaConfAddons>db-h2.xml</tl.app.metaConfAddons>
			</properties>

			<dependencies>
				<dependency>
				    <groupId>com.h2database</groupId>
				    <artifactId>h2</artifactId>
			  	</dependency>
			  	<dependency>
				    <groupId>com.manticore-projects.tools</groupId>
				    <artifactId>h2migrationtool</artifactId>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>with-mysql</id>

			<properties>
				<tl.app.metaConfAddons>db-mysql.xml</tl.app.metaConfAddons>
			</properties>

			<dependencies>
				<dependency>
					<groupId>com.mysql</groupId>
					<artifactId>mysql-connector-j</artifactId>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>with-oracle</id>

			<properties>
				<tl.app.metaConfAddons>db-oracle.xml</tl.app.metaConfAddons>
			</properties>

			<dependencies>
				<dependency>
				    <groupId>com.oracle.database.jdbc</groupId>
				    <artifactId>ojdbc11</artifactId>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>with-postgresql</id>

			<properties>
				<tl.app.metaConfAddons>db-postgres.xml</tl.app.metaConfAddons>
			</properties>

			<dependencies>
				<dependency>
				    <groupId>org.postgresql</groupId>
				    <artifactId>postgresql</artifactId>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>with-db2</id>

			<properties>
				<tl.app.metaConfAddons>db-db2.xml</tl.app.metaConfAddons>
			</properties>

			<dependencies>
				<dependency>
					<groupId>com.top-logic</groupId>
					<artifactId>ext-com-ibm-db2</artifactId>
					<type>pom</type>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>with-mssql</id>

			<properties>
				<tl.app.metaConfAddons>db-mssql.xml</tl.app.metaConfAddons>
			</properties>

			<dependencies>
				<dependency>
					<groupId>com.top-logic</groupId>
					<artifactId>ext-com.microsoft-sqlserver-jdbc</artifactId>
					<type>pom</type>
				</dependency>
			</dependencies>
		</profile>
		
	  	<profile>
	  		<id>bos</id>
	  		
	  		<activation>
	  			<activeByDefault>false</activeByDefault>
	  		</activation>
	  		
	  		<dependencies>
			    <dependency>
					<groupId>com.top-logic</groupId>
					<artifactId>bos-deepl</artifactId>
					<version>${tl.version}</version>
			    </dependency>

			    <dependency>
			      <groupId>com.top-logic</groupId>
			      <artifactId>bos-ldap</artifactId>
			      <version>${tl.version}</version>
			    </dependency>
	  		</dependencies>
	  	</profile>
	</profiles>
	
	<build>
		<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>com.top-logic</groupId>
										<artifactId>tl-maven-plugin</artifactId>
										<versionRange>[1.0.0,)</versionRange>
										<goals>
											<goal>strip-sources</goal>
											<goal>rewrite-classes</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>com.top-logic</groupId>
				<artifactId>tl-maven-plugin</artifactId>
				<version>7.6.1</version>

				<executions>
					<execution>
						<id>strip-main-sources</id>

						<goals>
							<goal>strip-sources</goal>
						</goals>

						<configuration>
							<baseDir>${project.build.sourceDirectory}</baseDir>
							<targetDir>${project.build.directory}/src-main-stripped</targetDir>
							<mappingProperties>${project.build.outputDirectory}/META-INF/source-mapping.properties</mappingProperties>
						</configuration>
					</execution>

					<execution>
						<id>rewrite-main-classes</id>

						<goals>
							<goal>rewrite-classes</goal>
						</goals>

						<configuration>
							<baseDir>${project.build.outputDirectory}</baseDir>
							<targetDir>${project.build.outputDirectory}</targetDir>
							<mappingProperties>${project.build.outputDirectory}/META-INF/source-mapping.properties</mappingProperties>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
