<?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.3.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>

		<openchemlibjs.version>7.4.0</openchemlibjs.version>
		<!-- This is the checksum from the package distributed via npm. -->
		<openchemlibjs.sha256>6e12e9d8b79ca1bf22fe3abbe2fd1288023a8766ca8a89c2c1061668bc1fe6bb</openchemlibjs.sha256>

		<molpaintjs.version>v0.3.5-alpha</molpaintjs.version>
		<molpaintjs.sha256>580893aa3ad25abc2a78d3bee8ff14d2a9a4486e6d8df9291149f471e2c16791</molpaintjs.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>
			<plugin>
				<groupId>com.googlecode.maven-download-plugin</groupId>
				<artifactId>download-maven-plugin</artifactId>
				<version>1.6.1</version>
				<executions>
					<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>
						</configuration>
					</execution>
					<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>
						</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>
								<include>ResourcesLoader.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>
							</includes>
							<outputFilename>MolecularFaces.js</outputFilename>
							<closureLanguageOut>ECMASCRIPT5_STRICT</closureLanguageOut>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.2.0</version>
				<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>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-web-api</artifactId>
			<version>7.0</version>
			<scope>provided</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>
		<!-- CDK is used during molfile validation and conversion. -->
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-core</artifactId>
			<version>2.3</version>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-ctab</artifactId>
			<version>2.3</version>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-data</artifactId>
			<version>2.3</version>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-formula</artifactId>
			<version>2.3</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-valencycheck</artifactId>
			<version>2.3</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-io</artifactId>
			<version>2.3</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>