<?xml version="1.0" encoding="UTF-8" ?>
<!--
  Copyright (C) 2020 FVA GmbH

  Licensed under the Apache License, Version 2.0 (the "License"); you may not
  use this file except in compliance with the License. You may obtain a copy
  of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  License for the specific language governing permissions and limitations under
  the License.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
	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>io.github.fva-net</groupId>
		<artifactId>rexs-api-java-project</artifactId>
		<version>0.13.0</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<artifactId>rexs-api-java</artifactId>

	<name>REXS-API-Java :: API</name>

	<dependencies>

		<!-- JAXB API only -->
		<dependency>
			<groupId>jakarta.xml.bind</groupId>
			<artifactId>jakarta.xml.bind-api</artifactId>
		</dependency>

		<!-- JAXB implementation -->
		<dependency>
			<groupId>org.glassfish.jaxb</groupId>
			<artifactId>jaxb-runtime</artifactId>
		</dependency>

		<!-- JAXB @XmlElementWrapper Plugin (see https://github.com/dmak/jaxb-xew-plugin) -->
		<dependency>
			<groupId>com.github.jaxb-xew-plugin</groupId>
			<artifactId>jaxb-xew-plugin</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Jackson for JSON -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
		</dependency>

		<!-- Unit tesing -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources/</directory>
				<excludes>
					<exclude>**/*.properties</exclude>
					<exclude>**/*.yml</exclude>
				</excludes>
				<filtering>false</filtering>
			</resource>
			<resource>
				<directory>src/main/resources/</directory>
				<includes>
					<include>**/*.properties</include>
					<include>**/*.yml</include>
				</includes>
				<filtering>true</filtering>
			</resource>
		</resources>

		<plugins>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>${project.build.directory}/generated-sources/jaxb/rexs-schema</source>
								<source>${project.build.directory}/generated-sources/jaxb/rexs-file</source>
								<source>${project.build.directory}/generated-sources/jaxb/rexs-changelog</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>jaxb2-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>xjc-rexs-schema</id>
						<goals>
							<goal>xjc</goal>
						</goals>
						<configuration>
							<sources>
								<source>${basedir}/src/main/resources/info/rexs/xsd/rexs-schema.xsd</source>
							</sources>
							<packageName>info.rexs.schema.jaxb</packageName>
							<outputDirectory>${project.build.directory}/generated-sources/jaxb/rexs-schema</outputDirectory>
							<arguments>
								<argument>-Xxew</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>xjc-rexs-file</id>
						<goals>
							<goal>xjc</goal>
						</goals>
						<configuration>
							<sources>
								<source>${basedir}/src/main/resources/info/rexs/xsd/rexs-file.xsd</source>
							</sources>
							<packageName>info.rexs.model.jaxb</packageName>
							<outputDirectory>${project.build.directory}/generated-sources/jaxb/rexs-file</outputDirectory>
							<arguments>
								<argument>-Xxew</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>xjc-rexs-changelog</id>
						<goals>
							<goal>xjc</goal>
						</goals>
						<configuration>
							<sources>
								<source>${basedir}/src/main/resources/info/rexs/xsd/rexs-changelog.xsd</source>
							</sources>
							<packageName>info.rexs.upgrade.upgraders.changelog.jaxb</packageName>
							<outputDirectory>${project.build.directory}/generated-sources/jaxb/rexs-changelog</outputDirectory>
							<arguments>
								<argument>-Xxew</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

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

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<executions>
					<execution>
						<id>make-assembly</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<finalName>rexs-api-java_v${project.version}</finalName>
							<appendAssemblyId>false</appendAssemblyId>
							<descriptors>
								<descriptor>src/main/assembly/distribution.xml</descriptor>
							</descriptors>
							<attach>false</attach>
						</configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

</project>
