<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>

	<groupId>org.coldis</groupId>
	<artifactId>configuration</artifactId>
	<version>1.0.0</version>
	<packaging>pom</packaging>

	<name>Common configuration</name>
	<description>Common configuration and dependencies.</description>
	<url>http://coldis.org/project/configuration</url>
	<licenses>
		<license>
			<name>GPL</name>
		</license>
	</licenses>
	<developers>
		<developer>
			<email>me@rvcoutinho.com</email>
		</developer>
	</developers>

	<properties>

		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<project.target>${project.basedir}/target</project.target>

		<project.config.source.main.resources.include>**/**</project.config.source.main.resources.include>
		<project.config.source.main.resources.exclude>zzz</project.config.source.main.resources.exclude>
		<project.config.spring.aop.phase>none</project.config.spring.aop.phase>
		<project.config.process.annotations.phase>generate-sources</project.config.process.annotations.phase>
		<project.config.process.test.annotations.phase>generate-test-sources</project.config.process.test.annotations.phase>
		<project.config.source.main.compile.include>**/*.java</project.config.source.main.compile.include>
		<project.config.source.main.compile.exclude>zzz</project.config.source.main.compile.exclude>
		<project.config.source.main.compile.annotationProcessors />
		<project.config.source.main.aspect.phase>process-classes</project.config.source.main.aspect.phase>
		<project.config.source.test.compile.include>**/*.java</project.config.source.test.compile.include>
		<project.config.source.test.compile.exclude>zzz</project.config.source.test.compile.exclude>
		<project.config.source.test.compile.annotationProcessors />
		<project.config.source.test.aspect.phase>process-test-classes</project.config.source.test.aspect.phase>
		<project.config.infrastructure.include>*</project.config.infrastructure.include>
		<project.config.infrastructure.build.path />
		<project.config.infrastructure.build.phase>none</project.config.infrastructure.build.phase>
		<project.config.infrastructure.deploy.path>${project.config.infrastructure.build.path}</project.config.infrastructure.deploy.path>
		<project.config.infrastructure.deploy.phase>none</project.config.infrastructure.deploy.phase>
		<project.config.infrastructure.release.path>${project.config.infrastructure.build.path}</project.config.infrastructure.release.path>
		<project.config.infrastructure.release.phase>none</project.config.infrastructure.release.phase>
		<project.config.jacoco.prepare>none</project.config.jacoco.prepare>
		<project.config.jacoco.report>none</project.config.jacoco.report>
		<project.config.spring.aspect.ltw.phase>none</project.config.spring.aspect.ltw.phase>
		<project.config.spring.aspect.ltw.args>-javaagent:${project.target}/aspectjweaver.jar
			-javaagent:${project.target}/spring-instrument.jar</project.config.spring.aspect.ltw.args>
		<project.config.source.test.args />
		<project.config.assembly.phase>none</project.config.assembly.phase>
		<project.config.assembly.descriptors />
		<project.config.source.main.package.include>**/**</project.config.source.main.package.include>
		<project.config.source.main.package.exclude>zzz</project.config.source.main.package.exclude>
		<project.config.attach.sources.phase>package</project.config.attach.sources.phase>
		<project.config.attach.javadocs.phase>package</project.config.attach.javadocs.phase>
		<project.config.spring.boot.package.phase>none</project.config.spring.boot.package.phase>
		<project.config.spring.boot.package.args />
		<project.config.spring.boot.package.main />
		<project.config.release.gpg.passphrase />
		<project.config.release.gpg.phase>verify</project.config.release.gpg.phase>

		<project.config.repository.private>coldis-private-software-repository</project.config.repository.private>
		<project.config.repository.private.snapshot.url>http://software-repository.infrastructure.coldis.org/repository/maven-snapshots</project.config.repository.private.snapshot.url>
		<project.config.repository.private.release.url>http://software-repository.infrastructure.coldis.org/repository/maven-releases</project.config.repository.private.release.url>
		<project.config.repository.public>coldis-public-software-repository</project.config.repository.public>
		<project.config.repository.public.snapshot.url>https://oss.sonatype.org/content/repositories/snapshots</project.config.repository.public.snapshot.url>
		<project.config.repository.public.release.url>https://oss.sonatype.org/service/local/staging/deploy/maven2</project.config.repository.public.release.url>
		<project.config.repository.public.repository.url>https://oss.sonatype.org/</project.config.repository.public.repository.url>
		<project.config.repository.oss.phase>deploy</project.config.repository.oss.phase>

		<java.version>11</java.version>
		<jackson.version>2.13.0</jackson.version>
		<slf4j.version>1.7.32</slf4j.version>
		<aspectj.tools.version>1.9.6</aspectj.tools.version>
		<junit-jupiter.version>5.8.1</junit-jupiter.version>
		<junit.version>4.13.2</junit.version>
		<spring.boot.version>2.2.13.RELEASE</spring.boot.version>
		<spring.boot.oauth.version>2.5.0.RELEASE</spring.boot.oauth.version>
		<spring.boot.social.version>2.1.6.RELEASE</spring.boot.social.version>
		<apache.commons.version>3.12.0</apache.commons.version>
		<apache.collections.version>4.4</apache.collections.version>
		<apache.text.version>1.9</apache.text.version>
		<apache.io.version>2.11.0</apache.io.version>
		<velocity.version>1.7</velocity.version>
		<itext.version>5.5.13.2</itext.version>
		<javax-persistence.version>2.2</javax-persistence.version>
		<jpa>2.2</jpa>
		<swagger.version>1.6.3</swagger.version>
		<springfox.swagger.version>3.0.0</springfox.swagger.version>
		<hikaricp.version>5.0.0</hikaricp.version>
		<postgresql.version>42.3.1</postgresql.version>
		<hibernate.version>5.6.1.Final</hibernate.version>

		<maven.dependency.version>3.1.2</maven.dependency.version>
		<maven.compiler.version>3.8.1</maven.compiler.version>
		<maven.aspectj.version>1.12.6</maven.aspectj.version>
		<maven.jar.version>3.2.0</maven.jar.version>
		<maven.exec.version>3.0.0</maven.exec.version>
		<maven.asm.version>9.1</maven.asm.version>
		<maven.assembly.version>3.3.0</maven.assembly.version>
		<maven.jacoco.version>0.8.6</maven.jacoco.version>
		<maven.surefire.version>2.22.2</maven.surefire.version>
		<maven.deploy.version>2.8.2</maven.deploy.version>
		<maven.release.version>2.5.3</maven.release.version>
		<maven.nexus.staging.version>1.6.8</maven.nexus.staging.version>

	</properties>

	<scm>
		<url>https://github.com/coldis-org/configuration</url>
		<connection>scm:git:https://github.com/coldis-org/configuration.git</connection>
		<developerConnection>scm:git:git@github.com:coldis-org/configuration.git</developerConnection>
		<tag>configuration-1.0.0</tag>
	</scm>

	<distributionManagement>
		<snapshotRepository>
			<id>${project.config.repository.public}</id>
			<url>${project.config.repository.public.snapshot.url}</url>
		</snapshotRepository>
		<repository>
			<id>${project.config.repository.public}</id>
			<url>${project.config.repository.public.release.url}</url>
		</repository>
	</distributionManagement>

	<dependencyManagement>
		<dependencies>

			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-parent</artifactId>
				<version>${spring.boot.version}</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.velocity</groupId>
				<artifactId>velocity</artifactId>
				<version>${velocity.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-collections4</artifactId>
				<version>${apache.collections.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-text</artifactId>
				<version>${apache.text.version}</version>
			</dependency>
			<dependency>
				<groupId>commons-io</groupId>
				<artifactId>commons-io</artifactId>
				<version>${apache.io.version}</version>
			</dependency>

			<dependency>
				<groupId>org.postgresql</groupId>
				<artifactId>postgresql</artifactId>
				<version>${postgresql.version}</version>
			</dependency>

			<dependency>
				<groupId>com.itextpdf</groupId>
				<artifactId>itextpdf</artifactId>
				<version>${itext.version}</version>
			</dependency>
			<dependency>
				<groupId>com.itextpdf</groupId>
				<artifactId>itext-pdfa</artifactId>
				<version>${itext.version}</version>
			</dependency>
			<dependency>
				<groupId>com.itextpdf.tool</groupId>
				<artifactId>xmlworker</artifactId>
				<version>${itext.version}</version>
			</dependency>

			<dependency>
				<groupId>io.springfox</groupId>
				<artifactId>springfox-boot-starter</artifactId>
				<version>${springfox.swagger.version}</version>
			</dependency>
			<dependency>
				<groupId>io.springfox</groupId>
				<artifactId>springfox-swagger-ui</artifactId>
				<version>${springfox.swagger.version}</version>
			</dependency>

			<dependency>
				<groupId>io.swagger</groupId>
				<artifactId>swagger-annotations</artifactId>
				<version>${swagger.version}</version>
			</dependency>

			<dependency>
				<groupId>com.zaxxer</groupId>
				<artifactId>HikariCP</artifactId>
				<version>${hikaricp.version}</version>
			</dependency>

		</dependencies>
	</dependencyManagement>

	<dependencies>

	</dependencies>

	<build>

		<directory>${project.target}</directory>

		<resources>

			<resource>
				<directory>${project.basedir}/src/main/resources</directory>
				<includes>
					<include>${project.config.source.main.resources.include}</include>
				</includes>
				<excludes>
					<exclude>${project.config.source.main.resources.exclude}</exclude>
				</excludes>
			</resource>
			<resource>
				<directory>${project.basedir}</directory>
				<includes>
					<include>artifact.properties</include>
					<include>artifact_properties.groovy</include>
				</includes>
				<targetPath>${project.target}</targetPath>
				<filtering>true</filtering>
			</resource>

		</resources>

		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>${maven.dependency.version}</version>
				<executions>
					<execution>
						<phase>${project.config.spring.aspect.ltw.phase}</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<artifactItems>
								<artifactItem>
									<groupId>org.aspectj</groupId>
									<artifactId>aspectjweaver</artifactId>
									<type>jar</type>
									<overWrite>true</overWrite>
									<outputDirectory>${project.build.directory}</outputDirectory>
									<destFileName>aspectjweaver.jar</destFileName>
								</artifactItem>
								<artifactItem>
									<groupId>org.springframework</groupId>
									<artifactId>spring-instrument</artifactId>
									<type>jar</type>
									<overWrite>true</overWrite>
									<outputDirectory>${project.build.directory}</outputDirectory>
									<destFileName>spring-instrument.jar</destFileName>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven.compiler.version}</version>

				<configuration>
					<release>${java.version}</release>
					<forceJavacCompilerUse>true</forceJavacCompilerUse>
				</configuration>

				<executions>

					<execution>
						<id>process-annotations</id>
						<phase>${project.config.process.annotations.phase}</phase>
						<goals>
							<goal>compile</goal>
						</goals>
						<configuration>
							<proc>only</proc>
							<failOnError>false</failOnError>
							<includes>
								<include>${project.config.source.main.compile.include}</include>
							</includes>
							<excludes>
								<exclude>${project.config.source.main.compile.exclude}</exclude>
							</excludes>
							<annotationProcessors>${project.config.source.main.compile.annotationProcessors}</annotationProcessors>
						</configuration>
					</execution>

					<execution>
						<id>process-test-annotations</id>
						<phase>${project.config.process.test.annotations.phase}</phase>
						<goals>
							<goal>testCompile</goal>
						</goals>
						<configuration>
							<proc>only</proc>
							<failOnError>false</failOnError>
							<debug>true</debug>
							<testIncludes>
								<testInclude>${project.config.source.test.compile.include}</testInclude>
							</testIncludes>
							<testExcludes>
								<testExclude>${project.config.source.test.compile.exclude}</testExclude>
							</testExcludes>
							<annotationProcessors>${project.config.source.test.compile.annotationProcessors}</annotationProcessors>
						</configuration>
					</execution>

					<execution>
						<id>default-compile</id>
						<goals>
							<goal>compile</goal>
						</goals>
						<configuration>
							<proc>none</proc>
							<includes>
								<include>${project.config.source.main.compile.include}</include>
							</includes>
							<excludes>
								<exclude>${project.config.source.main.compile.exclude}</exclude>
							</excludes>
						</configuration>
					</execution>

					<execution>
						<id>default-testCompile</id>
						<goals>
							<goal>testCompile</goal>
						</goals>
						<configuration>
							<proc>none</proc>
							<testIncludes>
								<testInclude>${project.config.source.test.compile.include}</testInclude>
							</testIncludes>
							<testExcludes>
								<testExclude>${project.config.source.test.compile.exclude}</testExclude>
							</testExcludes>
						</configuration>
					</execution>

				</executions>

				<dependencies>
					<dependency>
						<groupId>org.ow2.asm</groupId>
						<artifactId>asm</artifactId>
						<version>${maven.asm.version}</version> <!-- Use newer version of ASM -->
					</dependency>
				</dependencies>

			</plugin>

			<plugin>
				<groupId>com.nickwongdev</groupId>
				<artifactId>aspectj-maven-plugin</artifactId>
				<version>${maven.aspectj.version}</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<proc>none</proc>
					<complianceLevel>${java.version}</complianceLevel>
					<showWeaveInfo>true</showWeaveInfo>
					<verbose>true</verbose>
					<Xlint>ignore</Xlint>
					<aspectLibraries>
						<aspectLibrary>
							<groupId>org.springframework</groupId>
							<artifactId>spring-aspects</artifactId>
						</aspectLibrary>
						<aspectLibrary>
							<groupId>org.springframework.security</groupId>
							<artifactId>spring-security-aspects</artifactId>
						</aspectLibrary>
					</aspectLibraries>
				</configuration>
				<executions>
					<execution>
						<id>aspectj-compile</id>
						<phase>${project.config.source.main.aspect.phase}</phase>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
					<execution>
						<id>aspectj-test-compile</id>
						<phase>${project.config.source.test.aspect.phase}</phase>
						<goals>
							<goal>test-compile</goal>
						</goals>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.aspectj</groupId>
						<artifactId>aspectjtools</artifactId>
						<version>${aspectj.tools.version}</version>
					</dependency>
				</dependencies>

			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven.jar.version}</version>
				<configuration>
					<includes>
						<include>${project.config.source.main.package.include}</include>
					</includes>
					<excludes>
						<exclude>${project.config.source.main.package.exclude}</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>${maven.exec.version}</version>
				<executions>
					<execution>
						<id>docker-build</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>${project.config.infrastructure.build.phase}</phase>
						<configuration>
							<executable>operational_utils_docker_build_modules</executable>
							<arguments>
								<argument>--base-directory</argument>
								<argument>${project.config.infrastructure.build.path}</argument>
								<argument>--include-modules</argument>
								<argument>${project.config.infrastructure.include}</argument>
								<argument>--version</argument>
								<argument>${project.version}</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>docker-push-latest</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>${project.config.infrastructure.deploy.phase}</phase>
						<configuration>
							<executable>operational_utils_docker_build_modules</executable>
							<arguments>
								<argument>--push</argument>
								<argument>--base-directory</argument>
								<argument>${project.config.infrastructure.deploy.path}</argument>
								<argument>--include-modules</argument>
								<argument>${project.config.infrastructure.include}</argument>
								<argument>--version</argument>
								<argument>${project.version}</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>${maven.assembly.version}</version>
				<executions>
					<execution>
						<phase>${project.config.assembly.phase}</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<descriptors>
								${project.config.assembly.descriptors}
							</descriptors>
						</configuration>
					</execution>
				</executions>
			</plugin>


			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>${maven.jacoco.version}</version>
				<configuration>
					<destFile>${project.build.directory}/coverage-reports/jacoco-unit.exec</destFile>
					<dataFile>${project.build.directory}/coverage-reports/jacoco-unit.exec</dataFile>
				</configuration>
				<executions>

					<execution>
						<id>jacoco-prepare</id>
						<phase>${project.config.jacoco.prepare}</phase>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>

					<execution>
						<id>jacoco-report</id>
						<phase>${project.config.jacoco.report}</phase>
						<goals>
							<goal>report</goal>
						</goals>
					</execution>

				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${maven.surefire.version}</version>
				<configuration>
					<argLine>${project.config.source.test.args}</argLine>
					<reuseForks>false</reuseForks>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.hibernate.orm.tooling</groupId>
				<artifactId>hibernate-enhance-maven-plugin</artifactId>
				<version>${hibernate.version}</version>
				<executions>
					<execution>
						<configuration>
							<enableLazyInitialization>true</enableLazyInitialization>
						</configuration>
						<goals>
							<goal>enhance</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${spring.boot.version}</version>
				<executions>
					<execution>
						<phase>${project.config.spring.boot.package.phase}</phase>
						<goals>
							<goal>repackage</goal>
						</goals>
						<configuration>
							<mainClass>${project.config.spring.boot.package.main}</mainClass>
							<jvmArguments>${project.config.spring.boot.package.args}</jvmArguments>
							<classifier>run</classifier>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>${maven.deploy.version}</version>
				<executions>
					<execution>
						<id>default-deploy</id>
						<phase>deploy</phase>
						<goals>
							<goal>deploy</goal>
						</goals>
						<configuration />
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>${maven.release.version}</version>
				<configuration>
					<localCheckout>true</localCheckout>
					<arguments>-Dgpg.passphrase=${project.config.release.gpg.passphrase}
						-DskipTests -Dmaven.test.skipTests=true -Dmaven.test.skip=true</arguments>
					<goals>deploy -DskipTests -Dmaven.test.skipTests=true
						-Dmaven.test.skip=true</goals>
					<waitBeforeTagging>10</waitBeforeTagging>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<version>${maven.nexus.staging.version}</version>
				<extensions>true</extensions>
				<executions>
					<execution>
						<id>default-deploy</id>
						<phase>${project.config.repository.oss.phase}</phase>
						<goals>
							<goal>deploy</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<serverId>${project.config.repository.public}</serverId>
					<nexusUrl>${project.config.repository.public.repository.url}</nexusUrl>
					<autoReleaseAfterClose>true</autoReleaseAfterClose>
				</configuration>
			</plugin>

		</plugins>

	</build>

	<profiles>

		<profile>
			<id>release</id>
			<activation>
				<property>
					<name>performRelease</name>
					<value>true</value>
				</property>
			</activation>
			<build>
				<plugins>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>3.0.1</version>
						<executions>
							<execution>
								<id>attach-sources</id>
								<phase>${project.config.attach.sources.phase}</phase>
								<goals>
									<goal>jar</goal>
								</goals>
								<configuration>
									<includes>
										<include>${project.config.source.main.compile.include}</include>
									</includes>
									<excludes>
										<exclude>${project.config.source.main.compile.exclude}</exclude>
									</excludes>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>3.0.1</version>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<phase>${project.config.attach.javadocs.phase}</phase>
								<goals>
									<goal>jar</goal>
								</goals>
								<configuration>
									<failOnError>false</failOnError>
									<sourceFileIncludes>
										<sourceFileInclude>${project.config.source.main.compile.include}</sourceFileInclude>
									</sourceFileIncludes>
									<sourceFileExcludes>
										<sourceFileExclude>${project.config.source.main.compile.exclude}</sourceFileExclude>
									</sourceFileExcludes>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>${project.config.release.gpg.phase}</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.6.0</version>
						<executions>
							<execution>
								<id>docker-push-release</id>
								<goals>
									<goal>exec</goal>
								</goals>
								<phase>${project.config.infrastructure.release.phase}</phase>
								<configuration>
									<executable>operational_utils_docker_build_modules</executable>
									<arguments>
										<argument>--push</argument>
										<argument>--base-directory</argument>
										<argument>${project.config.infrastructure.release.path}</argument>
										<argument>--version</argument>
										<argument>${project.version}</argument>
									</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>

				</plugins>
			</build>
		</profile>

	</profiles>

</project>