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

    Copyright (c) 2016, 2026 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->
<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>jakarta.json.bind</groupId>
        <artifactId>jakarta.json.bind-parent</artifactId>
        <version>3.1.0-M2</version>
    </parent>

    <artifactId>jakarta.json.bind-api</artifactId>
    <packaging>jar</packaging>

    <name>Jakarta JSON Binding API</name>

    <properties>
        <!-- build-helper-maven-plugin configuration -->
        <legal.doc.source>${project.basedir}/..</legal.doc.source>

        <!-- maven-javadoc-plugin configuration -->
        <release.spec.feedback>jsonb-dev@eclipse.org</release.spec.feedback>

        <!-- glassfish-copyright-maven-plugin settings -->
        <copyright.exclude>${project.basedir}/../etc/config/copyright-exclude</copyright.exclude>
        <copyright.templatefile>${project.basedir}/../etc/config/epl-copyright.txt</copyright.templatefile>
        <copyright.bsdTemplateFile>${project.basedir}/../etc/config/edl-copyright.txt</copyright.bsdTemplateFile>
        <copyright.ignoreyear>true</copyright.ignoreyear>
        <copyright.scmonly>true</copyright.scmonly>
        <copyright.update>false</copyright.update>

        <!-- spotbugs-maven-plugin settings -->
        <spotbugs.exclude>${project.basedir}/../etc/config/spotbugs-exclude.xml</spotbugs.exclude>
        <spotbugs.skip>false</spotbugs.skip>
        <spotbugs.threshold>Low</spotbugs.threshold>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Adds NOTICE.md and LICENSE.md from the project root into META-INF of the produced JAR. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-legal-resource</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${legal.doc.source}</directory>
                                    <includes>
                                        <include>NOTICE.md</include>
                                        <include>LICENSE.md</include>
                                    </includes>
                                    <targetPath>META-INF</targetPath>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Generates a unique build number (${buildNumber}) from SCM metadata, embedded in the OSGi manifest. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <configuration>
                    <format>{0,date,MM/dd/yyyy hh:mm aa}</format>
                    <items>
                        <item>timestamp</item>
                    </items>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Generates the OSGi MANIFEST.MF under target/classes/META-INF during process-classes,
                 embedding bundle metadata, export packages, and spec version headers. -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                    <instructions>
                        <Build-Id>${buildNumber}</Build-Id>
                        <Bundle-Description>
                            Jakarta JSON Binding ${spec.version} API jar
                        </Bundle-Description>
                        <Bundle-Name>Jakarta JSON Binding API jar</Bundle-Name>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Version>${bundle.version}</Bundle-Version>
                        <Extension-Name>${project.groupId}</Extension-Name>
                        <Implementation-Version>${bundle.version}</Implementation-Version>
                        <Specification-Vendor>Eclipse Foundation</Specification-Vendor>
                        <Specification-Version>${spec.version}</Specification-Version>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <Export-Package>
                            jakarta.json.bind.*; version=${bundle.version}
                        </Export-Package>
                        <!-- Avoid BND package scanner picking up string literal as a package -->
                        <Import-Package>
                            !org.eclipse.yasson,
                            *
                        </Import-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>osgi-bundle</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Packages the compiled classes into a JAR, using the OSGi-generated MANIFEST.MF
                 produced by the maven-bundle-plugin. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <!-- Compiles Java sources with all lint warnings enabled. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <!-- Generates cross-referenced HTML source reports, used as input by maven-checkstyle-plugin
                 and other reporting tools. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>jxr</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Verifies source style against checkstyle rules on every compile. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <outputFile>${project.build.directory}/checkstyle/checkstyle-result.xml</outputFile>
                    <configLocation>${project.basedir}/../etc/config/checkstyle.xml</configLocation>
                    <failOnViolation>true</failOnViolation>
                    <failsOnError>true</failsOnError>
                    <excludes>**/module-info.java</excludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Attaches a sources JAR to the build. -->
            <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>
            <!-- Verifies that every source file carries the required EPL-2.0 / GPL-2.0+CE copyright header. -->
            <plugin>
                <groupId>org.glassfish.copyright</groupId>
                <artifactId>glassfish-copyright-maven-plugin</artifactId>
                <configuration>
                    <excludeFile>${copyright.exclude}</excludeFile>
                    <scmOnly>${copyright.scmonly}</scmOnly>
                    <update>${copyright.update}</update>
                    <ignoreYear>${copyright.ignoreyear}</ignoreYear>
                    <quiet>false</quiet>
                    <templateFile>${copyright.templatefile}</templateFile>
                    <bsdTemplateFile>${copyright.bsdTemplateFile}</bsdTemplateFile>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Generates the API Javadoc with custom spec title, header, and license footer. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <sourceFileExcludes>
                        <sourceFileExclude>**/module-info.java</sourceFileExclude>
                        <sourceFileExclude>target/**/*.java</sourceFileExclude>
                    </sourceFileExcludes>
                    <docfilessubdirs>true</docfilessubdirs>
                    <links>
                        <link>http://docs.oracle.com/en/java/javase/17/docs/api/</link>
                    </links>
                    <detectJavaApiLink>false</detectJavaApiLink>
                    <detectOfflineLinks>false</detectOfflineLinks>
                    <doctitle>Jakarta JSON Binding ${project.version} API Specification</doctitle>
                    <header><![CDATA[<br>Jakarta JSON Binding API v${project.version}]]>
                    </header>
                    <bottom><![CDATA[
                    Comments to: <a href="mailto:${release.spec.feedback}">${release.spec.feedback}</a>.<br>
                    Copyright &#169; 2019, 2026 Eclipse Foundation. All Rights Reserved.<br>
                    Use is subject to <a href="{@docRoot}/doc-files/EFSL.html" target="_top">license terms</a>.]]>
                    </bottom>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Static analysis to detect bug patterns; fails the build on High-severity findings. -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <skip>${spotbugs.skip}</skip>
                    <threshold>${spotbugs.threshold}</threshold>
                    <fork>true</fork>
                    <excludeFilterFile>${spotbugs.exclude}</excludeFilterFile>
                    <failThreshold>High</failThreshold>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
