 <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>
    <name>Flowable UI Admin</name>
    <artifactId>flowable-ui-admin-app</artifactId>
	<packaging>war</packaging>

    <parent>
      <groupId>org.flowable</groupId>
      <artifactId>flowable-ui-admin</artifactId>
      <version>6.5.0.1-SNAPSHOT</version>
    </parent>

    <properties>
      	<!-- Maven build properties -->
  		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

	<profiles>

        <profile>
            <id>h2mem</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.h2database</groupId>
                    <artifactId>h2</artifactId>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <arguments>
                                <argument>--com.sun.management.jmxremote.port=4002</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>postgresql</id>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <arguments>
                                <argument>--spring.datasource.driver-class-name=org.postgresql.Driver</argument>
                                <argument>--spring.datasource.url=jdbc:postgresql://localhost:5432/flowable</argument>
                                <argument>--spring.datasource.username=flowable</argument>
                                <argument>--spring.datasource.password=flowable</argument>
                                <argument>--com.sun.management.jmxremote.port=4000</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>mysql</id>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <arguments>
                                <argument>--spring.datasource.driver-class-name=com.mysql.jdbc.Driver</argument>
                                <argument>--spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8</argument>
                                <argument>--spring.datasource.username=flowable</argument>
                                <argument>--spring.datasource.password=flowable</argument>
                                <argument>--com.sun.management.jmxremote.port=4002</argument>
                                <argument>--flowable.admin.app.server-config.process.port=9999</argument>
                                <argument>--flowable.admin.app.server-config.process.context-root=flowable-task</argument>
                                <argument>--flowable.admin.app.server-config.process.rest-root=process-api</argument>
                                <argument>--flowable.admin.app.server-config.dmn.app.port=9999</argument>
                                <argument>--flowable.admin.app.server-config.dmn.app.context-root=flowable-task</argument>
                                <argument>--flowable.admin.app.server-config.dmn.app.rest-root=dmn-api</argument>
                                <argument>--flowable.admin.app.server-config.form.app.port=9999</argument>
                                <argument>--flowable.admin.app.server-config.form.app.context-root=flowable-task</argument>
                                <argument>--flowable.admin.app.server-config.form.app.rest-root=form-api</argument>
                                <argument>--flowable.admin.app.server-config.content.app.port=9999</argument>
                                <argument>--flowable.admin.app.server-config.content.app.context-root=flowable-task</argument>
                                <argument>--flowable.admin.app.server-config.content.app.rest-root=content-api</argument>
                                <argument>--flowable.admin.app.server-config.cmmn.app.port=9999</argument>
                                <argument>--flowable.admin.app.server-config.cmmn.app.context-root=flowable-task</argument>
                                <argument>--flowable.admin.app.server-config.cmmn.app.rest-root=cmmn-api</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

		<profile>
			<id>distro</id>
			<build>
				<plugins>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

        <!-- database qa profile -->
        <profile>
            <id>database</id>
            <activation>
                <property>
                    <name>database</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <!-- only worked with this version, there might be a bug with antrun see http://jira.codehaus.org/browse/MANTRUN-109 -->
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>database-test-create-schema</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="updating db configuration to db ${database}" />
                                        <copy file="${user.home}/.flowable/enterprise/build.flowable-admin.${database}.properties"
                                              tofile="target/test-classes/META-INF/flowable-admin/TEST-db.properties"
                                              overwrite="true" />
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>database-test-drop-schema</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="dropping schema in ${database}" />
                                        <java classname="org.flowable.db.DbScriptUtil" classpathref="maven.test.classpath" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>docker-deps</id>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
        </profile>

        <!-- docker image build and push -->
        <profile>
            <id>docker</id>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>docker-resources</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>target/</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/docker/</directory>
                                            <filtering>false</filtering>
                                            <excludes>
                                                <exclude>**/*.yml</exclude>
                                            </excludes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>build</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <configuration>
                                    <tag>latest</tag>
                                </configuration>
                            </execution>
                            <execution>
                                <id>push-latest</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>push</goal>
                                </goals>
                                <configuration>
                                    <tag>latest</tag>
                                </configuration>
                            </execution>
                            <execution>
                                <id>push-version</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>tag</goal>
                                    <goal>push</goal>
                                </goals>
                                <configuration>
                                    <tag>${project.version}</tag>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <repository>flowable/flowable-admin</repository>
                            <buildArgs>
                                <WAR_FILE>${project.build.finalName}.war</WAR_FILE>
                            </buildArgs>
                            <contextDirectory>${project.build.directory}</contextDirectory>
                            <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

	</profiles>

	<dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate.validator</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-properties-migrator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-admin-conf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-admin-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-admin-logic</artifactId>
        </dependency>

		<!-- DATABASE -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <!-- <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.2-1004-jdbc4</version>
        </dependency>
        <dependency>
            <groupId>com.oracle.jdbc</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0.1</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.30</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>com.ibm.db2.jcc</groupId>
            <artifactId>db2jcc4</artifactId>
            <version>10.1</version>
        </dependency> -->

		<!-- TEST dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
	</dependencies>

	<!-- BUILD -->
	<build>
		<finalName>flowable-admin</finalName>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
                <excludes>
                    <exclude>static/fonts/**</exclude>
                    <exclude>static/additional_components/ui-grid/**</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>static/fonts/**</include>
                    <include>static/additional_components/ui-grid/**</include>
                </includes>
            </resource>
        </resources>

		<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludeArtifactIds>
                        spring-boot-configuration-processor
                    </excludeArtifactIds>
                </configuration>
            </plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.9</version>
				<configuration>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>true</downloadJavadocs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>sonar-maven-plugin</artifactId>
				<version>2.2</version>
			</plugin>
		</plugins>
	</build>

</project>
