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

    Copyright (c) 2021, 2025 Oracle, IBM Corporation, and/or their 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,
    or the Eclipse Distribution License v. 1.0 which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

-->

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.eclipse.ee4j</groupId>
        <artifactId>project</artifactId>
        <version>1.0.7</version>
        <relativePath/>
    </parent>

    <groupId>org.eclipse.persistence</groupId>
    <artifactId>org.eclipse.persistence.asm</artifactId>
    <version>9.8.0</version>

    <name>EclipseLink ASM</name>
    <description>EclipseLink extension for Java bytecode manipulation and analysis framework</description>

    <scm>
        <connection>scm:git:https://github.com/eclipse-ee4j/eclipselink-asm.git</connection>
        <url>https://github.com/eclipse-ee4j/eclipselink-asm.git</url>
    </scm>

    <organization>
        <name>Eclipse.org - EclipseLink Project</name>
        <url>http://www.eclipse.org/eclipselink</url>
    </organization>

    <inceptionYear>2007</inceptionYear>
    <url>http://www.eclipse.org/eclipselink</url>

    <licenses>
        <license>
            <name>Eclipse Public License - v 2.0</name>
            <url>http://www.eclipse.org/legal/epl-2.0</url>
            <distribution>repo</distribution>
        </license>
        <license>
            <name>Eclipse Distribution License - v 1.0</name>
            <url>http://www.eclipse.org/org/documents/edl-v10.php</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <issueManagement>
        <system>github</system>
        <url>https://github.com/eclipse-ee4j/eclipselink-asm/issues</url>
    </issueManagement>

    <mailingLists>
        <mailingList>
            <name>EclipseLink user's mailing list</name>
            <post>eclipselink-users@eclipse.org</post>
            <subscribe>https://accounts.eclipse.org/mailing-list/eclipselink-users</subscribe>
            <unsubscribe>https://accounts.eclipse.org/mailing-list/eclipselink-users</unsubscribe>
            <archive>https://dev.eclipse.org/mhonarc/lists/eclipselink-users/</archive>
        </mailingList>
        <mailingList>
            <name>EclipseLink developer's mailing list</name>
            <post>eclipselink-dev@eclipse.org</post>
            <subscribe>https://accounts.eclipse.org/mailing-list/eclipselink-dev</subscribe>
            <unsubscribe>https://accounts.eclipse.org/mailing-list/eclipselink-dev</unsubscribe>
            <archive>https://dev.eclipse.org/mhonarc/lists/eclipselink-dev/</archive>
        </mailingList>
    </mailingLists>

    <properties>
        <legal.doc.source>${project.basedir}/..</legal.doc.source>
        <!-- 2.6.x has Java SE 7 as min supported JDK -->
        <base.java.level>8</base.java.level>
        <upper.java.level>9</upper.java.level>
        <!-- CQ #24269 -->
        <asm.version>9.8</asm.version>
        <junit.version>4.13.2</junit.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!--Source dependencies used for repackaging-->
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm</artifactId>
                <version>${asm.version}</version>
                <classifier>sources</classifier>
            </dependency>
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm-commons</artifactId>
                <version>${asm.version}</version>
                <classifier>sources</classifier>
            </dependency>
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm-tree</artifactId>
                <version>${asm.version}</version>
                <classifier>sources</classifier>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-commons</artifactId>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-tree</artifactId>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>
        <!--Test dependencies-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>buildnumber-maven-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>com.sun.wts.tools.ant</groupId>
                    <artifactId>package-rename-task</artifactId>
                    <version>1.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>5.1.9</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.4.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.glassfish.hk2</groupId>
                    <artifactId>osgiversion-maven-plugin</artifactId>
                    <version>4.0.0-M3</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[11,)</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>[3.8.5,)</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <configuration>
                    <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                    <revisionOnScmFailure>false</revisionOnScmFailure>
                    <shortRevisionLength>7</shortRevisionLength>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <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>
            <!--Unpack origin ASM sources-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>src-dependencies</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>org.ow2.asm</includeGroupIds>
                            <includeScope>provided</includeScope>
                            <classifier>sources</classifier>
                            <outputDirectory>${project.build.directory}/unpacked-sources/asm-src</outputDirectory>
                            <!-- original html doc excluded to avoid javadoc build error on JDK 11/ASM 7.3.1-->
                            <excludes>META-INF/MANIFEST.MF,**/*.html</excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--Repackage ASM sources to internal packages-->
            <plugin>
                <groupId>com.sun.wts.tools.ant</groupId>
                <artifactId>package-rename-task</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <id>repackage-sources</id>
                        <goals>
                            <goal>rename</goal>
                        </goals>
                        <configuration>
                            <srcDir>${project.build.directory}/unpacked-sources/asm-src</srcDir>
                            <rootDir>${project.build.directory}/generated-sources/asm-src</rootDir>
                            <patterns>
                                <!-- Refactor classes package from .../unpacked-sources to org.eclipse.persistence.internal.libraries.asm -->
                                <org.objectweb.asm>org.eclipse.persistence.internal.libraries.asm</org.objectweb.asm>
                            </patterns>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>fix-asm</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <!-- ASM itself uses 1.8 source level and then retrofits the bytecode
                            to work on Java SE 5+. We don't use retrofitter, so we need
                            to fix sources to compile for Java SE 7 (EclipseLink 2.6.x) -->
                            <target>
                                <replace file="${project.build.directory}/generated-sources/asm-src/org/eclipse/persistence/internal/libraries/asm/tree/Util.java">
                                    <replacefilter>
                                        <replacetoken><![CDATA[new ArrayList<>(1)]]></replacetoken>
                                        <replacevalue><![CDATA[new ArrayList<T>(1)]]></replacevalue>
                                    </replacefilter>
                                </replace>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>${upper.java.level}</release>
                </configuration>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <compilerArgument>-Xlint:all</compilerArgument>
                        </configuration>
                    </execution>
                    <execution>
                        <id>base-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <release>${base.java.level}</release>
                            <excludes>
                                <exclude>module-info.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!--Generate OSGi bundle/manifest-->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                        <configuration>
                            <niceManifest>true</niceManifest>
                            <instructions>
                                <Export-Package>*</Export-Package>
                            </instructions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.glassfish.hk2</groupId>
                <artifactId>osgiversion-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compute-full-osgi-version</id>
                        <goals>
                            <goal>compute-osgi-version</goal>
                        </goals>
                        <configuration>
                            <versionPropertyName>project.fullosgi.version</versionPropertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compute-osgi-version</id>
                        <goals>
                            <goal>compute-osgi-version</goal>
                        </goals>
                        <configuration>
                            <dropVersionComponent>qualifier</dropVersionComponent>
                            <versionPropertyName>project.osgi.version</versionPropertyName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifest>
                            <addDefaultEntries>false</addDefaultEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultEntries>false</addDefaultEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build-Id>${project.version} - ${buildNumber}</Implementation-Build-Id>
                            <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                            <Bundle-Name>EclipseLink ASM Source</Bundle-Name>
                            <Bundle-SymbolicName>${project.artifactId}.source</Bundle-SymbolicName>
                            <Bundle-Version>${project.fullosgi.version}</Bundle-Version>
                            <Eclipse-SourceBundle>${project.artifactId};version="${project.osgi.version}"</Eclipse-SourceBundle>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <doclint>-missing</doclint>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>license-check</id>
            <pluginRepositories>
                <pluginRepository>
                    <!-- org.eclipse.dash:license-tool-plugin is nor final nor in central yet -->
                    <id>dash-licenses-snapshots</id>
                    <url>https://repo.eclipse.org/content/repositories/dash-licenses-snapshots/</url>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.eclipse.dash</groupId>
                            <artifactId>license-tool-plugin</artifactId>
                            <version>1.0.3-SNAPSHOT</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.eclipse.dash</groupId>
                        <artifactId>license-tool-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>license-check</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>license-check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
