<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright 2023 Barend Garvelink

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<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>nl.garvelink.oss</groupId>
    <artifactId>iban</artifactId>
    <version>1.15.0</version>
    <packaging>jar</packaging>

    <name>Java IBAN</name>
    <description>A Java package for handling International Bank Account Numbers (IBANs).</description>
    <url>https://barend.github.io/java-iban/</url>
    <inceptionYear>2013</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/barend/java-iban.git</url>
        <developerConnection>scm:git:git@github.com:barend/java-iban.git</developerConnection>
        <connection>scm:git:git@github.com:barend/java-iban.git</connection>
        <tag>release-1.15.0</tag>
    </scm>

    <developers>
        <developer>
            <name>Barend Garvelink</name>
            <url>https://github.com/barend</url>
        </developer>
    </developers>

    <contributors>
        <contributor>
            <name>Daniel Holm</name>
            <url>https://github.com/trustlydaniel</url>
        </contributor>
        <contributor>
            <name>D. Oosterveld</name>
            <url>https://github.com/dusdanig</url>
        </contributor>
        <contributor>
            <name>Matthias Vill</name>
            <url>https://github.com/TheConstructor</url>
        </contributor>
        <contributor>
            <name>sdomonkos</name>
            <url>https://github.com/sdomonkos</url>
        </contributor>
    </contributors>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.10.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.10.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>generate-code</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>codegen.sh</executable>
                            <sourceRoot>${project.build.directory}/generated-sources/jinja2</sourceRoot>
                            <useMavenLogger>true</useMavenLogger>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                    </compilerArgs>
                    <release>8</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>4.8.5.0</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
            <plugin>
                <!-- Javadoc generation fails on JDK 16 when using the inherited plugin configuration. -->
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.6.3</version>
                <configuration>
                    <!-- https://stackoverflow.com/a/66170815/49489 -->
                    <source>8</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <arguments>--strict-checksums</arguments>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <goals>deploy</goals>
                    <pushChanges>false</pushChanges>
                    <releaseProfiles>release</releaseProfiles>
                    <signTag>true</signTag>
                    <tagNameFormat>release-@{project.version}</tagNameFormat>
                    <useReleaseProfile>false</useReleaseProfile>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- This profile adds the src/main/java11 directory to the build. -->
            <id>java11-module</id>
            <activation>
                <!-- We cannot use the <jdk> activation rule, because that looks at the
                     host JVM, not at the compiler target version. We can compile for
                     Java 8 while running on JDK 11, and if we do, the module-info file
                     causes a compiler error.

                     So instead we evaluate the maven.compiler.target property. The
                     downside here is that we cannot compare against a version range.
                     There's no or-operator either. The result is that we only evaluate
                     the module-info file when targeting exactly version 11; not "any
                     version with module support".

                     This is not ideal, but at least it ensures that the CI build covers
                     the module-info file, so it's good enough.

                     Note that the compiled module-info that we ship in the JAR file
                     lives in src/main/resources; we don't compile the module info
                     as part of the release build.-->
                <property>
                    <name>maven.compiler.target</name>
                    <value>11</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.0</version>
                        <executions>
                            <execution>
                                <id>include-extra-sources-dir</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.basedir}/src/main/java11</source>
                                        <source>${project.build.directory}/generated-sources/jinja2</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.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.6.3</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>3.2.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.4.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <tokenAuth>true</tokenAuth>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
<!-- vim: set et sw=4: -->
