<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>fr.gouv.vitam</groupId>
		<artifactId>workspace</artifactId>
		<version>8.0.3</version>
	</parent>
	<artifactId>workspace-rest</artifactId>
	<name>workspace Rest</name>

	<properties>
		<unix.name>workspace</unix.name>
		<unix.user>vitam</unix.user>
		<unix.group>vitam</unix.group>
		<jib.skip>true</jib.skip>
	</properties>
	<dependencies>
		<dependency>
			<groupId>fr.gouv.vitam</groupId>
			<artifactId>common-private</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitam</groupId>
			<artifactId>workspace-common</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
            <groupId>io.rest-assured</groupId>
			<artifactId>rest-assured</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitam</groupId>
			<artifactId>common-junit</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.swagger.core.v3</groupId>
			<artifactId>swagger-jaxrs2</artifactId>
		</dependency>
	</dependencies>

	<build>

		<plugins>
			<plugin>
				<groupId>com.google.cloud.tools</groupId>
				<artifactId>jib-maven-plugin</artifactId>
				<configuration>
					<to>
						<image>${env.SERVICE_DOCKER_PUSH_URL}/vitam/workspace</image>
						<tags>
							<tag>${git.commit.id.describe-short}</tag>
							<tag>${project.version}</tag>
						</tags>
					</to>
				</configuration>
			</plugin>
			<plugin>
				<!-- Dependency manipulation (copy, unpack) and analysis. -->
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
							<includeScope>compile</includeScope>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-config-resources</id>
						<phase>validate</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/conf/sysconfig</outputDirectory>
							<resources>
								<resource>
									<directory>${basedir}/src/main/conf</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
					<!-- Debian -->
					<execution>
						<id>copy-debian-controlFiles</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/control</outputDirectory>
							<overwrite>true</overwrite>
							<resources>
								<resource>
									<directory>${basedir}/src/deb/control</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<mainClass>fr.gouv.vitam.workspace.rest.WorkspaceMain</mainClass>
						</manifest>
					</archive>
				</configuration>
			</plugin>


			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>rpm-maven-plugin</artifactId>
				<configuration>
					<disabled>false</disabled>
					<license>CeCILL 2.1</license>
					<distribution>Vitam Project</distribution>
					<group>Application/Archiving</group>
					<packager>Vitam Package Team</packager>
					<defineStatements/>
					<targetOS>linux</targetOS>
					<requires>
						<require>systemd</require>
						<require>${jdk.version.rpm}</require>
						<require>vitam-user-${unix.user}</require>
					</requires>
					<defaultDirmode>750</defaultDirmode>
					<defaultFilemode>640</defaultFilemode>
					<defaultUsername>${unix.user}</defaultUsername>
					<defaultGroupname>${unix.group}</defaultGroupname>
					<mappings>
						<mapping>
							<directory>/vitam/lib/${unix.name}</directory>
							<artifact/>
							<dependency/>
						</mapping>
						<mapping>
							<directory>/vitam/conf/${unix.name}</directory>
							<sources>
								<source>
									<location>${project.build.directory}/conf</location>
								</source>
							</sources>
						</mapping>
					</mappings>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.eclipse.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>${jetty.version}</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<runOrder>alphabetical</runOrder>
					<systemPropertyVariables>
						<log4j.configurationFile>log4j2-test.xml</log4j.configurationFile>
						<org.owasp.esapi.resources>../../common/common-private/src/main/resources/esapi</org.owasp.esapi.resources>
					</systemPropertyVariables>
					<classpathDependencyExcludes>
						<classpathDependencyExclude>org.apache.logging.log4j:log4j-to-slf4j</classpathDependencyExclude>
					</classpathDependencyExcludes>
				</configuration>
			</plugin>
			<!-- Debian -->
			<plugin>
				<artifactId>jdeb</artifactId>
				<groupId>org.vafer</groupId>
				<configuration>
					<snapshotExpand>true</snapshotExpand>
					<skip>false</skip>
					<controlDir>${project.build.directory}/control</controlDir>
					<dataSet>

						<!-- Artifacts -->
						<data>
							<src>${project.build.directory}/${project.build.finalName}.jar</src>
							<type>file</type>
							<mapper>
								<type>perm</type>
								<user>${unix.user}</user>
								<group>${unix.group}</group>
								<filemode>0644</filemode>
								<prefix>/vitam/lib/${unix.name}/</prefix>
							</mapper>
						</data>

						<data>
							<src>${project.build.directory}/dependencies</src>
							<type>directory</type>
							<missingSrc>ignore</missingSrc>
							<mapper>
								<type>perm</type>
								<user>${unix.user}</user>
								<group>${unix.group}</group>
								<filemode>0644</filemode>
								<prefix>/vitam/lib/${unix.name}</prefix>
							</mapper>
						</data>
						<data>
							<src>${project.build.directory}/conf</src>
							<type>directory</type>
							<missingSrc>ignore</missingSrc>
							<mapper>
								<type>perm</type>
								<user>${unix.user}</user>
								<group>${unix.group}</group>
								<filemode>0750</filemode>
								<prefix>/vitam/conf/${unix.name}</prefix>
							</mapper>
						</data>
						<!-- Additional templates -->
						<data>
							<type>template</type>
							<paths>
								<path>/vitam/tmp/${unix.name}</path>
								<path>/vitam/log/${unix.name}</path>
							</paths>
							<mapper>
								<type>perm</type>
								<user>${unix.user}</user>
								<group>${unix.group}</group>
							</mapper>
						</data>

					</dataSet>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.mycila</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<version>3.0</version>
				<configuration>
					<header>../../licenses/cecill21.txt</header>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

		</plugins>

	</build>

</project>
