<?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>com.ellucian</groupId>
    <artifactId>integration-sdk-java-objects-${jarFileContent}</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>Ellucian Ethos Integration Java SDK ${jarFileContent} Object Library</name>
    <description>
        Provides various packages of generated objects representing data model schemas for easier use with handling API
        requests and responses.  These object libraries work with the Ethos Integration SDK to enable developers using
        the SDK to handle their API requests and responses as objects rather than JSON raw strings or JsonNodes.
    </description>
    <url>https://github.com/ellucianEthos</url>

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

    <developers>
        <developer>
            <name>Ellucian Developer Experience Team</name>
            <organization>Ellucian</organization>
            <organizationUrl>https://www.ellucian.com</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/ellucian-developer/integration-sdk-java-objects.git</connection>
        <developerConnection>scm:git:ssh://github.com/ellucian-developer/integration-sdk-java-objects.git</developerConnection>
        <url>http://github.com/ellucian-developer/integration-sdk-java-objects/tree/main</url>
        <tag>integration-sdk-java-objects-1.0.0</tag>
    </scm>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <schemaSourceDir>src/main/resources</schemaSourceDir>
        <generatedTargetPackage>com.ellucian.generated</generatedTargetPackage>
        <jarFileContent>all</jarFileContent>
        <excludeSchemasDirFromSource>.</excludeSchemasDirFromSource>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.13.2.2</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.2.0</version>
                        <configuration>
                            <excludes>
                                <exclude>com/ellucian/schema/**</exclude>
                                <exclude>schemas.properties</exclude>
                                <exclude>linesToFind.properties</exclude>
                                <exclude>linesToAdd.properties</exclude>
                                <exclude>resources.properties</exclude>
                            </excludes>
                            <includes>
                                <include>com/ellucian/generated/**</include>
                                <include>LICENSE</include>
                            </includes>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</version>
                        <configuration>
                            <excludes>
                                <exclude>com/ellucian/schema/**</exclude>
                                <exclude>schemas.properties</exclude>
                                <exclude>linesToFind.properties</exclude>
                                <exclude>linesToAdd.properties</exclude>
                                <exclude>resources.properties</exclude>
                                <exclude>${excludeSchemasDirFromSource}</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jsonschema2pojo</groupId>
                        <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                        <version>1.1.1</version>
                        <configuration>
                            <!--<sourceDirectory>${basedir}/src/main/resources/schemas/eedm</sourceDirectory>-->
                            <!--<targetPackage>com.ellucian.generated.eedm.ban</targetPackage>-->
                            <sourceDirectory>${schemaSourceDir}</sourceDirectory>
                            <excludes>*.properties</excludes>
                            <targetPackage>${generatedTargetPackage}</targetPackage>
                            <generateBuilders>true</generateBuilders>
                            <formatDates>false</formatDates>
                            <formatDateTimes>false</formatDateTimes>
                            <!--<dateType>java.lang.String</dateType>
                            <dateTimeType>java.lang.String</dateTimeType>-->
                            <outputEncoding>UTF-8</outputEncoding>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                                <phase>process-resources</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.1.0</version>
                        <configuration>
                            <sourcepath>target/generated-sources/jsonschema2pojo</sourcepath>
                            <subpackages>com.ellucian.generated</subpackages>
                            <show>private</show>
                            <failOnError>false</failOnError>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.8.1</version>
                        <configuration>
                            <fork>true</fork>
                            <meminitial>1024m</meminitial>
                            <maxmem>4096m</maxmem>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--batch</arg>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dev</id>
            <properties>
                <maven.test.skip>true</maven.test.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.2.0</version>
                        <configuration>
                            <excludes>
                                <exclude>com/ellucian/schema/**</exclude>
                                <exclude>schemas.properties</exclude>
                                <exclude>linesToFind.properties</exclude>
                                <exclude>linesToAdd.properties</exclude>
                                <exclude>resources.properties</exclude>
                            </excludes>
                            <includes>
                                <include>com/ellucian/generated/**</include>
                            </includes>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.jsonschema2pojo</groupId>
                        <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                        <version>1.1.1</version>
                        <configuration>
                            <!--<sourceDirectory>${basedir}/src/main/resources/schemas/eedm</sourceDirectory>-->
                            <!--<targetPackage>com.ellucian.generated.eedm.ban</targetPackage>-->
                            <sourceDirectory>${schemaSourceDir}</sourceDirectory>
                            <excludes>*.properties</excludes>
                            <targetPackage>${generatedTargetPackage}</targetPackage>
                            <generateBuilders>true</generateBuilders>
                            <formatDates>false</formatDates>
                            <formatDateTimes>false</formatDateTimes>
                            <!--<dateType>java.lang.String</dateType>
                            <dateTimeType>java.lang.String</dateTimeType>-->
                            <outputEncoding>UTF-8</outputEncoding>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
<!--            This plugin is outside of the release and dev profiles for copying the dependency jars to a location so that the SchemaPrepper can run before
                generating Java source code from the schemas.  The command to run this is 'mvn dependency:copy' -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>com.fasterxml.jackson.core</groupId>
                            <artifactId>jackson-databind</artifactId>
                            <version>2.13.2.2</version>
                            <type>jar</type>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                            <groupId>com.fasterxml.jackson.core</groupId>
                            <artifactId>jackson-annotations</artifactId>
                            <version>2.13.2</version>
                            <type>jar</type>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                            <groupId>com.fasterxml.jackson.core</groupId>
                            <artifactId>jackson-core</artifactId>
                            <version>2.13.2</version>
                            <type>jar</type>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                    <!-- other configurations here -->
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>