<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>com.atomgraph</groupId>
    <artifactId>linkeddatahub</artifactId>
    <version>3.2.1</version>
    <packaging>${packaging.type}</packaging>

    <name>AtomGraph LinkedDataHub</name>
    <description>The Knowledge Graph notebook</description>
    <url>https://atomgraph.github.io/LinkedDataHub/</url>
    <inceptionYear>2014</inceptionYear>

    <developers>
        <developer>
            <id>namedgraph</id>
            <email>martynas@atomgraph.com</email>
            <roles>
                <role>Developer</role>
                <role>Founder</role>
            </roles>
            <organization>AtomGraph</organization>
            <organizationUrl>https://atomgraph.com</organizationUrl>
        </developer>
    </developers>
    
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
        <build.warName>ROOT</build.warName>
        <saxon-js.stylesheet>/static/com/atomgraph/linkeddatahub/xsl/client.xsl</saxon-js.stylesheet>
        <xsl.root.dir>static/com/atomgraph/</xsl.root.dir>
        <xsl.file.list>xsl.file.list.txt</xsl.file.list>
        <xsl.file.list.comma>xsl.file.list.comma.txt</xsl.file.list.comma>
    </properties>

    <scm>
        <url>https://github.com/AtomGraph/LinkedDataHub</url>
        <connection>scm:git:git://github.com/AtomGraph/LinkedDataHub.git</connection>
        <developerConnection>scm:git:git@github.com:AtomGraph/LinkedDataHub.git</developerConnection>
        <tag>linkeddatahub-3.2.1</tag>
    </scm>

    <repositories>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>apache-repo-releases</id>
            <url>https://repository.apache.org/content/repositories/releases/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>apache-repo-snapshots</id>
            <url>https://repository.apache.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    
    <dependencies>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>4.0.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.connectors</groupId>
            <artifactId>jersey-apache-connector</artifactId>
            <version>2.30.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <version>2.30.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-processing</artifactId>
            <version>2.30.1</version>
        </dependency>
        <dependency>
            <groupId>xom</groupId>
            <artifactId>xom</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>30.1-jre</version>
        </dependency>
        <dependency>
            <groupId>com.atomgraph.etl.csv</groupId>
            <artifactId>csv2rdf</artifactId>
            <version>2.1.9</version>
            <exclusions>
                <!-- exclude SL4J from CSV2RDF - we already got another coming from Core. Otherwise we get https://www.slf4j.org/codes.html#multiple_bindings -->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
                <!-- exclude jakarta.json as its version clashes with Jersey's -->
                <exclusion>
                    <groupId>org.glassfish</groupId>
                    <artifactId>jakarta.json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- TO-DO: replace with AtomGraph Core -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>processor</artifactId>
            <version>3.13.21</version>
            <exclusions>
                <!-- exclude jakarta.json as its version clashes with Jersey's -->
                <exclusion>
                    <groupId>org.glassfish</groupId>
                    <artifactId>jakarta.json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>client</artifactId>
            <version>3.1.53</version>
            <classifier>classes</classifier>
            <exclusions>
                <!-- exclude jakarta.json as its version clashes with Jersey's -->
                <exclusion>
                    <groupId>org.glassfish</groupId>
                    <artifactId>jakarta.json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>client</artifactId>
            <version>3.1.53</version>
            <type>war</type>
            <exclusions>
                <!-- exclude jakarta.json as its version clashes with Jersey's -->
                <exclusion>
                    <groupId>org.glassfish</groupId>
                    <artifactId>jakarta.json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- required by jsonld-java - version same as Jersey's HTTP Client -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient-cache</artifactId>
            <version>4.5.9</version>
        </dependency>
        <dependency>
            <groupId>com.auth0</groupId>
            <artifactId>java-jwt</artifactId>
            <version>3.11.0</version>
        </dependency>
        <dependency>
            <groupId>net.jodah</groupId>
            <artifactId>expiringmap</artifactId>
            <version>0.5.9</version>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.14.3</version>
        </dependency>
        <dependency>
            <!-- comes with atomgraph/letsencrypt-tomcat -->
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-coyote</artifactId>
            <version>9.0.59</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>log4j.properties</exclude>
                </excludes>
            </resource>
        </resources>
                
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>default-war</id>
                            <phase>none</phase>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <releaseProfiles>release</releaseProfiles>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.0</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                    <!-- ignore warnings about internal Java APIs which we use for WebIDCertGen -->
                    <compilerArgs>
                        <arg>-XDignore.symbol.file</arg>
                        <arg>--add-exports</arg>
                        <arg>java.base/sun.security.tools.keytool=ALL-UNNAMED</arg>
                    </compilerArgs>
                    <fork>true</fork>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.12</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>find-xsl-files</id>
                        <phase>package</phase>
                        <configuration>
                            <executable>find</executable>
                            <workingDirectory>${project.build.directory}/${build.warName}/${xsl.root.dir}</workingDirectory>
                            <outputFile>${project.build.directory}/${xsl.file.list}</outputFile>
                            <commandlineArgs>. -type f -name '*.xsl'</commandlineArgs>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>comma-separate-xsl-files</id>
                        <phase>package</phase>
                        <configuration>
                            <executable>paste</executable>
                            <workingDirectory>${project.build.directory}</workingDirectory>
                            <outputFile>${project.build.directory}/${xsl.file.list.comma}</outputFile>
                            <commandlineArgs>-s -d, ${project.build.directory}/${xsl.file.list}</commandlineArgs>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.honton.chas</groupId>
                <artifactId>readfiles-maven-plugin</artifactId>
                <version>0.0.1</version>
                <executions>
                    <execution>
                        <id>read-comma-separated-xsl-file-list</id>
                        <phase>package</phase>
                        <goals>
                            <goal>readfiles</goal>
                        </goals>
                        <configuration>
                            <files>
                                <!-- set xsl.file.list.comma.txt property -->
                                <file>${project.build.directory}/${xsl.file.list.comma}</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.soebes.maven.plugins</groupId>
                <artifactId>iterator-maven-plugin</artifactId>
                <version>0.5.1</version>
                <executions>
                    <execution>
                        <id>inline-xml-entities</id>
                        <phase>package</phase>
                        <goals>
                            <goal>iterator</goal>
                        </goals>
                        <configuration>
                            <content>${xsl.file.list.comma.txt}</content>
                            <pluginExecutors>
                                <pluginExecutor>
                                    <plugin>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>exec-maven-plugin</artifactId>
                                        <version>3.0.0</version>
                                    </plugin>
                                    <goal>java</goal>
                                    <configuration>
                                        <mainClass>net.sf.saxon.Query</mainClass>
                                        <commandlineArgs>-qs:"." -s:"${project.build.directory}/${build.warName}/${xsl.root.dir}/@item@" -o:"${project.build.directory}/${build.warName}/${xsl.root.dir}/@item@"</commandlineArgs>
                                    </configuration>
                                </pluginExecutor>
                            </pluginExecutors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.12.1</version>
                <configuration>
                    <nodeVersion>v14.8.0</nodeVersion>
                </configuration>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                    <execution>
                        <id>generate-sef</id>
                        <goals>
                            <goal>npx</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <arguments>xslt3 -t -xsl:${project.build.directory}/${build.warName}${saxon-js.stylesheet} -export:${project.build.directory}/${build.warName}${saxon-js.stylesheet}.sef.json -nogo -ns:##html5</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
                <configuration>
                    <warName>${build.warName}</warName>
                    <webappDirectory>${project.build.directory}/${build.warName}</webappDirectory>
                    <failOnMissingWebXml>true</failOnMissingWebXml>
                    <attachClasses>true</attachClasses>
                    <overlays>
                        <overlay>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>client</artifactId>
                        </overlay>
                    </overlays>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-war</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>exploded</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>package-war</id>
                        <phase>package</phase>
                        <goals>
                            <goal>war</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>standalone</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <packaging.type>war</packaging.type>
            </properties>
        </profile>
        <profile>
            <id>dependency</id>
            <properties>
                <packaging.type>jar</packaging.type>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <packaging.type>war</packaging.type>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</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>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>
                                <configuration>
                                    <!-- This is necessary for gpg to not try to use the pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
