<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright 2021 PubCOI.org
  ~
  ~ This program is free software; you can redistribute it and/or
  ~ modify it under the terms of the GNU Lesser General Public
  ~ License as published by the Free Software Foundation; either
  ~ version 3 of the License, or (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public License
  ~ along with this program; if not, write to the Free Software Foundation,
  ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  -->

<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>org.pubcoi.fos</groupId>
        <artifactId>parent</artifactId>
        <version>1.0.2</version>
    </parent>

    <artifactId>fos-depends-aspects</artifactId>
    <version>1.0.3</version>

    <name>fos-depends-aspects</name>
    <url>https://github.com/PubCOI/fos-depends-aspects</url>
    <description>Modified versions of PubCOI CDM for Fos</description>

    <scm>
        <connection>scm:git:git@github.com:PubCOI/fos-depends-aspects.git</connection>
        <developerConnection>scm:git:git@github.com:PubCOI/fos-depends-aspects.git</developerConnection>
        <url>https://github.com/PubCOI/fos-depends-aspects</url>
        <tag>fos-depends-aspects-1.0.3</tag>
    </scm>

    <licenses>
        <license>
            <name>GNU Lesser General Public License v3.0 or later</name>
            <url>https://www.gnu.org/licenses/lgpl-3.0-standalone.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>rmacd</id>
            <name>Ronald MacDonald</name>
            <email>ronald@rmacd.com</email>
            <roles>
                <role>developer</role>
                <role>project-administrator</role>
            </roles>
            <timezone>+00:00</timezone>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- project deps -->
        <version.pubcoi-schemas.hmgcf>1.0.2</version.pubcoi-schemas.hmgcf>
        <version.pubcoi-schemas.openc>1.0.0</version.pubcoi-schemas.openc>
        <version.pubcoi-schemas.mnis>1.0.0</version.pubcoi-schemas.mnis>
        <version.pubcoi-schemas.parlparse>1.0.0</version.pubcoi-schemas.parlparse>

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencyManagement>
        <!--     For some reason the CDM jar is trying to pull in 3.9 even though        -->
        <!--     the pom explicitly sets it to 3.11 ... artifact replacement is          -->
        <!--     shedding little light on the situation; so this is nasty, but it'll     -->
        <!--     at least explicitly set it when we pull it in ...                       -->
        <dependencies>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.pubcoi.schemas</groupId>
            <artifactId>hmg-contracts-finder</artifactId>
            <version>${version.pubcoi-schemas.hmgcf}</version>
        </dependency>
        <dependency>
            <groupId>org.pubcoi.schemas</groupId>
            <artifactId>opencorporates</artifactId>
            <version>${version.pubcoi-schemas.openc}</version>
        </dependency>
        <dependency>
            <groupId>org.pubcoi.schemas</groupId>
            <artifactId>hmg-mnis</artifactId>
            <version>${version.pubcoi-schemas.mnis}</version>
        </dependency>
        <dependency>
            <groupId>org.pubcoi.schemas</groupId>
            <artifactId>parlparse</artifactId>
            <version>${version.pubcoi-schemas.parlparse}</version>
        </dependency>
        <dependency>
            <!-- this is only pulled in for annotations -->
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.nickwongdev</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjrt</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <weaveDependencies>
                        <weaveDependency>
                            <groupId>org.pubcoi.schemas</groupId>
                            <artifactId>opencorporates</artifactId>
                        </weaveDependency>
                        <weaveDependency>
                            <groupId>org.pubcoi.schemas</groupId>
                            <artifactId>hmg-contracts-finder</artifactId>
                        </weaveDependency>
                        <weaveDependency>
                            <groupId>org.pubcoi.schemas</groupId>
                            <artifactId>hmg-mnis</artifactId>
                        </weaveDependency>
                        <weaveDependency>
                            <groupId>org.pubcoi.schemas</groupId>
                            <artifactId>parlparse</artifactId>
                        </weaveDependency>
                    </weaveDependencies>
                    <aspectDirectory>${project.build.directory}/src/main/java/org/pubcoi/fos/aj</aspectDirectory>
                    <showWeaveInfo>true</showWeaveInfo>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <complianceLevel>1.8</complianceLevel>
                </configuration>
                <!-- required to allow reading of bundle poms -->
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforcer</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <banDuplicatePomDependencyVersions />
                                <dependencyConvergence />
<!--                                <requireReleaseDeps />-->
                                <requireMavenVersion>
                                    <version>[3.5,)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <!-- Library must be built with 1.8 so that it can be   -->
                                    <!-- imported / used by those still on 1.8:             -->
                                    <!-- export JAVA_HOME=`/usr/libexec/java_home -v 1.8`   -->
                                    <version>[1.8,1.9)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <!-- unpack pubcoi dependencies so we're properly distributing sources -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>3.1.2</version>
                        <executions>
                            <execution>
                                <id>src-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeGroupIds>org.pubcoi.schemas</includeGroupIds>
                                    <classifier>sources</classifier>
                                    <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                                    <outputDirectory>${project.build.directory}/sources</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!-- attach unpacked sources from last step -->
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/sources</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.nickwongdev</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <configuration>
                            <verbose>true</verbose>
                            <privateScope>true</privateScope>
                            <complianceLevel>1.8</complianceLevel>
                        </configuration>
                        <executions>
                            <execution>
                                <id>generate-ajdoc</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>aspectj-report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-ajdoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classifier>javadoc</classifier>
                                    <classesDirectory>${project.build.directory}/site/aspectj-report</classesDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>info@pubcoi.org</keyname>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <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>
</project>
