<!--

    Copyright (c) 2013, 2017 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.glassfish.jsonp</groupId>
        <artifactId>demos</artifactId>
        <version>1.1.6</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <packaging>jar</packaging>
    <url>http://maven.apache.org</url>
    <artifactId>jsondemos-jsonpointer</artifactId>

    <properties>
        <main.class>org.glassfish.jsondemos.jsonpointer.JsonpointerDemo</main.class>
    </properties>

    <profiles>
        <profile>
            <id>all</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>jakarta.json</groupId>
                    <artifactId>jakarta.json-api</artifactId>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish</groupId>
                    <artifactId>jakarta.json</artifactId>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>example-jsonpointer-jdk8</id>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <mainClass>${main.class}</mainClass>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jdk9-setup</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>jakarta.json</groupId>
                    <artifactId>jakarta.json-api</artifactId>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish</groupId>
                    <artifactId>jakarta.json</artifactId>
                    <classifier>module</classifier>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
            <properties>
                <modules.directory>${project.build.directory}/modules</modules.directory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <configuration>
                            <stripVersion>true</stripVersion>
                            <outputDirectory>${modules.directory}</outputDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>get-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeArtifactIds>jakarta.json</includeArtifactIds>
                                </configuration>
                            </execution>
                            <execution>
                                <id>get-project-artifact</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>${project.artifactId}</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>--add-modules</argument>
                                <argument>org.glassfish.java.json</argument>
                                <argument>--module-path</argument>
                                <argument>${modules.directory}</argument>
                                <argument>-m</argument>
                                <argument>org.glassfish.java.json.demos.jsonpointer/${main.class}</argument>
                            </arguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>example-jsonpointer-jdk9</id>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
