<?xml version="1.0" encoding="UTF-8"?>
<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>de.ipb-halle</groupId>
	<artifactId>molecularfaces</artifactId>
	<version>0.4.0</version>
	<packaging>jar</packaging>

	<name>MolecularFaces</name>
	<description>Java Server Faces UI components for chemistry and biochemistry</description>
	<url>https://github.com/ipb-halle/MolecularFaces</url>

	<organization>
		<name>Leibniz Institute of Plant Biochemistry (IPB), Halle (Saale), Germany</name>
		<url>https://www.ipb-halle.de</url>
	</organization>

	<developers>
		<developer>
			<name>Frank Lange</name>
			<organization>Leibniz Institute of Plant Biochemistry (IPB), Halle (Saale), Germany</organization>
			<organizationUrl>https://www.ipb-halle.de</organizationUrl>
		</developer>
	</developers>

	<licenses>
		<license>
			<name>The Apache License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:https://github.com/ipb-halle/MolecularFaces.git</connection>
		<url>https://github.com/ipb-halle/MolecularFaces.git</url>
	</scm>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<cdk.version>2.7.1</cdk.version>

		<!-- OpenChemLib JS -->
		<openchemlibjs.version>7.4.1</openchemlibjs.version>
		<!-- This is the checksum from the package distributed via npm. -->
		<openchemlibjs.sha256>e37439f6f4f397bdadaf0091109516916216db16ca8aa1bcbee3b7bfbad8869d</openchemlibjs.sha256>

		<!-- MolPaintJS -->
		<molpaintjs.version>v0.3.5-alpha</molpaintjs.version>
		<molpaintjs.sha256>580893aa3ad25abc2a78d3bee8ff14d2a9a4486e6d8df9291149f471e2c16791</molpaintjs.sha256>

		<!-- openVectorEditor -->
		<openVectorEditor.version>16.3.18</openVectorEditor.version>
		<!-- These are the checksums from the package distributed via npm. -->
		<openVectorEditor.min.js.sha256>88ec80b623069665051cca04bc29764df508656792e23acee7ca0060318edb78</openVectorEditor.min.js.sha256>
		<openVectorEditor.main.css.sha256>7cc916424bf20811b989b6329acf2453c07be24d2a5477775282e72846beb604</openVectorEditor.main.css.sha256>
		<!--<openVectorEditor.icons-16.1645f50f.woff.sha256>9700ae986c3357a771c7276c8eb30d1adc0c7b270bfd0bd56f6ea2df568cb88b</openVectorEditor.icons-16.1645f50f.woff.sha256>
		<openVectorEditor.icons-16.2368f88a.eot.sha256>a8ef9e585479427f5f7fa35e4201caf851a748c5cdf7d89ecf5ba3bd84179eda</openVectorEditor.icons-16.2368f88a.eot.sha256>
		<openVectorEditor.icons-16.13933033.ttf.sha256>3159a9b5dbf9c28ea27e925b24a468fc51298a49e16be06341fdf672efa19605</openVectorEditor.icons-16.13933033.ttf.sha256>-->
	</properties>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.2.0</version>
				<configuration>
					<archive>
						<manifest>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
							<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
						</manifest>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.2.0</version>
				<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>
				<version>3.2.0</version>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<!-- 3rd party plugin downloads -->
			<plugin>
				<groupId>com.googlecode.maven-download-plugin</groupId>
				<artifactId>download-maven-plugin</artifactId>
				<version>1.6.1</version>
				<executions>
					<!-- OpenChemLib JS -->
					<execution>
						<id>download-openchemlibjs</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<!-- See https://github.com/cheminfo/openchemlib-js/issues/110#issuecomment-802697504 -->
							<url>https://unpkg.com/openchemlib@${openchemlibjs.version}/dist/openchemlib-full.js</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/openchemlibjs/</outputDirectory>
							<sha256>${openchemlibjs.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>

					<!-- MolPaintJS -->
					<execution>
						<id>download-molpaintjs</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://github.com/ipb-halle/MolPaintJS/releases/download/${molpaintjs.version}/molpaint.js</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/molpaintjs/</outputDirectory>
							<sha256>${molpaintjs.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>

					<!-- openVectorEditor -->
					<execution>
						<id>download-openVectorEditor-min-js</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://unpkg.com/open-vector-editor@${openVectorEditor.version}/umd/open-vector-editor.min.js</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/openVectorEditor/</outputDirectory>
							<sha256>${openVectorEditor.min.js.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>
					<execution>
						<id>download-openVectorEditor-main-css</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://unpkg.com/open-vector-editor@${openVectorEditor.version}/umd/main.css</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/openVectorEditor/</outputDirectory>
							<sha256>${openVectorEditor.main.css.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>
					<!--<execution>
						<id>download-openVectorEditor-icons-16.1645f50f.woff</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://unpkg.com/open-vector-editor@${openVectorEditor.version}/umd/icons-16.1645f50f.woff</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/openVectorEditor/</outputDirectory>
							<sha256>${openVectorEditor.icons-16.1645f50f.woff.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>
					<execution>
						<id>download-openVectorEditor-icons-16.2368f88a.eot</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://unpkg.com/open-vector-editor@${openVectorEditor.version}/umd/icons-16.2368f88a.eot</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/openVectorEditor/</outputDirectory>
							<sha256>${openVectorEditor.icons-16.2368f88a.eot.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>
					<execution>
						<id>download-openVectorEditor-icons-16.13933033.ttf</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://unpkg.com/open-vector-editor@${openVectorEditor.version}/umd/icons-16.13933033.ttf</url>
							<outputDirectory>${project.build.directory}/downloaded-resources/plugins/openVectorEditor/</outputDirectory>
							<sha256>${openVectorEditor.icons-16.13933033.ttf.sha256}</sha256>
							<checkSignature>true</checkSignature>
						</configuration>
					</execution>-->
				</executions>
			</plugin>
			<plugin>
				<groupId>com.github.blutorange</groupId>
				<artifactId>closure-compiler-maven-plugin</artifactId>
				<version>2.21.0</version>
				<configuration>
					<baseSourceDir>${project.basedir}/src/main</baseSourceDir>
					<baseTargetDir>${project.build.directory}/generated-resources</baseTargetDir>
				</configuration>
				<executions>
					<execution>
						<id>default-minify</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>minify</goal>
						</goals>
						<configuration>
							<encoding>UTF-8</encoding>
							<sourceDir>js</sourceDir>
							<targetDir>js</targetDir>
							<includes>
								<!-- Order is important! -->
								<include>ResourcesLoader.js</include>
								<include>OnChangeSubject.js</include>
								<include>MolecularFaces.js</include>
								<include>StructurePlugin.js</include>
								<include>StructureEditor.js</include>
								<include>OpenChemLibJSEditor.js</include>
								<include>OpenChemLibJSViewer.js</include>
								<include>MolPaintJSEditor.js</include>
								<include>MolPaintJSViewer.js</include>
								<include>MarvinJSEditor.js</include>
								<include>MarvinJSNamespaceLoader.js</include>
								<include>MarvinJSViewer.js</include>
								<include>OpenVectorEditorResizeHelper.js</include>
								<include>OpenVectorEditor.js</include>
							</includes>
							<outputFilename>MolecularFaces.min.js</outputFilename>
							<closureLanguageOut>ECMASCRIPT5_STRICT</closureLanguageOut>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.2.0</version>
				<configuration>
					<nonFilteredFileExtensions>
						<nonFilteredFileExtension>woff</nonFilteredFileExtension>
						<nonFilteredFileExtension>eot</nonFilteredFileExtension>
						<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
					</nonFilteredFileExtensions>
				</configuration>
				<executions>
					<execution>
						<id>copy-downloaded-resources</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>${project.build.directory}/downloaded-resources</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
							<outputDirectory>${project.build.directory}/classes/META-INF/resources/molecularfaces</outputDirectory>
						</configuration>
					</execution>
					<execution>
						<id>copy-generated-resources</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>${project.build.directory}/generated-resources</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
							<outputDirectory>${project.build.directory}/classes/META-INF/resources/molecularfaces</outputDirectory>
						</configuration>
					</execution>
					<execution>
						<id>copy-licenses</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>${project.basedir}/licenses</directory>
									<filtering>false</filtering>
								</resource>
							</resources>
							<outputDirectory>${project.build.directory}/classes/META-INF/licenses</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<!--
			Runtime dependencies
		-->
		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-web-api</artifactId>
			<version>7.0</version>
			<scope>provided</scope>
		</dependency>
		<!-- CDK is used during molfile validation and conversion. -->
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-core</artifactId>
			<version>${cdk.version}</version>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-ctab</artifactId>
			<version>${cdk.version}</version>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-data</artifactId>
			<version>${cdk.version}</version>
		</dependency>

		<!--
			 Test dependencies 
		-->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest</artifactId>
			<version>2.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.11.0</version>
			<scope>test</scope>
		</dependency>
		<!-- mocks for JSF classes -->
		<!-- Source code: https://github.com/apache/myfaces-test/tree/master/test22 -->
		<dependency>
			<groupId>org.apache.myfaces.test</groupId>
			<artifactId>myfaces-test22</artifactId>
			<version>1.0.8</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.myfaces.core</groupId>
			<artifactId>myfaces-impl</artifactId>
			<version>2.2.14</version>
			<scope>test</scope>
		</dependency>
		<!-- We need this dependency because org.apache.myfaces.core:myfaces-api does
		     not ship the javax.faces.LogStrings property files. -->
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.20</version>
			<scope>test</scope>
		</dependency>
		<!-- The bean validation API is provided by the JavaEE container only
			 during runtime, but not during tests. Note: We are using JavaEE 7
			 with bean validation 1.1, thus the ancient version. -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
			<version>5.4.3.Final</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.glassfish</groupId>
			<artifactId>javax.el</artifactId>
			<version>3.0.1-b12</version>
			<scope>test</scope>
		</dependency>
		<!-- used in verifications of molecules -->
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-formula</artifactId>
			<version>${cdk.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-valencycheck</artifactId>
			<version>${cdk.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-io</artifactId>
			<version>${cdk.version}</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<!-- release to ossrh: mvn clean deploy -P release -->
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</version>
						<configuration>
							<!-- Prevent gpg from using pinentry programs -->
							<gpgArguments>
								<arg>--pinentry-mode</arg>
								<arg>loopback</arg>
							</gpgArguments>
						</configuration>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>dependencyCheck</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.owasp</groupId>
						<artifactId>dependency-check-maven</artifactId>
						<version>6.5.3</version>
						<configuration>
							<failBuildOnAnyVulnerability>true</failBuildOnAnyVulnerability>
						</configuration>
						<executions>
							<execution>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>