<?xml version="1.0"?>
<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>io.earcam</groupId>
        <artifactId>io.earcam.utilitarian</artifactId>
        <version>1.2.0</version>
	</parent>

	<groupId>io.earcam.utilitarian</groupId>
	<artifactId>io.earcam.utilitarian.site.search.offline</artifactId>
	<packaging>jar</packaging>

	<description>Static site search functionality</description>
	<url>${site.url}${earcam.project.name.short}</url>

	<distributionManagement>
		<site>
			<id>netlify</id>
			<url>${site.url}${earcam.project.name.short}/</url>
		</site>
	</distributionManagement>

	<properties>
		<skip.execution.pitest>false</skip.execution.pitest>
		<earcam.project.name.short>site/search/offline</earcam.project.name.short>
		<!-- issues with unexposed lucene - revapi's checkDependencies=false not working? -->
		<revapi.skip>true</revapi.skip>

		<!-- 
			jacoco's argLine not merged,
			even with 'combine.self="append"', 
			but we can use late binding
		-->
		<surefire.argLine />
		<jpms.supplimental.surefire.argLine>
			--add-modules java.scripting
		</jpms.supplimental.surefire.argLine>
		
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.webjars.bower</groupId>
			<artifactId>lunr.js</artifactId>
			<version>2.1.0</version>
		</dependency>

		<!-- TODO switch to 2.1.2
		<dependency>
			<groupId>org.webjars.npm</groupId>
			<artifactId>github-com-olivernn-lunr-js</artifactId>
			<version>2.1.2</version>
		</dependency>
		 -->

		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-analyzers-common</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-core</artifactId>
		</dependency>

		<dependency>
			<groupId>org.jsoup</groupId>
			<artifactId>jsoup</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.pdfbox</groupId>
			<artifactId>pdfbox</artifactId>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.apache.pdfbox</groupId>
			<artifactId>xmpbox</artifactId>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.apache.pdfbox</groupId>
			<artifactId>fontbox</artifactId>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
		</dependency>

		<dependency>
			<groupId>io.earcam.utilitarian</groupId>
			<artifactId>io.earcam.utilitarian.io</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>io.earcam</groupId>
			<artifactId>io.earcam.unexceptional</artifactId>
		</dependency>

		<dependency>
			<groupId>javax.annotation</groupId>
			<artifactId>javax.annotation-api</artifactId>
		</dependency>

		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>jsr305</artifactId>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>

		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>java-hamcrest</artifactId>
		</dependency>

		<dependency>
			<groupId>javax.json.bind</groupId>
			<artifactId>javax.json.bind-api</artifactId>
		</dependency>

		<dependency>
			<groupId>javax.json</groupId>
			<artifactId>javax.json-api</artifactId>
		</dependency>

		<dependency>
			<groupId>org.eclipse</groupId>
			<artifactId>yasson</artifactId>
		</dependency>

		<dependency>
			<groupId>org.glassfish</groupId>
			<artifactId>javax.json</artifactId>
		</dependency>
		
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<scope>compile</scope>
			<!-- shade plugin failing to include otherwise -->
		</dependency>
		
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<scope>runtime</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<configuration>
					<instructions>
						<Main-Class>${project.artifactId}.Search</Main-Class>
					</instructions>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<executions>
					<execution>
						<id>jdk9-test</id>
						<configuration>
							<argLine>@{surefire.argLine}
								${jpms.supplimental.surefire.argLine}</argLine>
						</configuration>
					</execution>
					<execution>
						<id>jdk10-test</id>
						<configuration>
							<argLine>@{surefire.argLine}
								${jpms.supplimental.surefire.argLine}</argLine>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>3.1.1</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<!-- <minimizeJar>true</minimizeJar> -->
							<!-- <minimizeJar>true</minimizeJar> --><!-- buggy? where's SLF4J API? -->
							<shadedArtifactAttached>true</shadedArtifactAttached>
							<shadedClassifierName>uber</shadedClassifierName>
							<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
							<artifactSet>
								<includes>
									<include>*:*</include>
									<include>org.slf4j:slf4j-api</include>
								</includes>
							</artifactSet>
							<filters>
								<filter>
									<artifact>*:*</artifact>
									<excludes>
										<exclude>META-INF/*.SF</exclude>
										<exclude>META-INF/*.DSA</exclude>
										<exclude>META-INF/*.RSA</exclude>
										<exclude>module-info.class</exclude>
									</excludes>
								</filter>
							</filters>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
