<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-parent</artifactId>
        <version>5.18.6</version>
    </parent>
    <artifactId>activemq-client-jakarta</artifactId>
    <packaging>bundle</packaging>
    <name>ActiveMQ :: Client Jakarta</name>
    <description>Jakarta transition module for ActiveMQ Client implementation</description>
    <dependencies>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-client</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>jakarta.jms</groupId>
                    <artifactId>jakarta.jms-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jakarta.jms</groupId>
            <artifactId>jakarta.jms-api</artifactId>
            <version>${jakarta-jms-api-v3-version}</version>
        </dependency>
        <dependency>
            <groupId>org.fusesource.hawtbuf</groupId>
            <artifactId>hawtbuf</artifactId>
            <version>${hawtbuf-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jmdns</groupId>
            <artifactId>jmdns</artifactId>
            <optional>true</optional>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
		<properties>
			<maven.javadoc.skip>true</maven.javadoc.skip>
		</properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-source</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.activemq</groupId>
                                    <artifactId>activemq-client</artifactId>
                                    <classifier>sources</classifier>
                                    <type>jar</type>
                                    <outputDirectory>${project.build.directory}/copied-sources/activemq-client</outputDirectory>
                                    <excludes>**/META-INF/*,**/META-INF/maven/**,**/zeroconf/**</excludes>
                                    <includes>**/**</includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>${project.build.directory}/copied-sources/activemq-client/**/*.java</include>
                            </includes>
                            <excludes>
                                <exclude>${project.build.directory}/copied-sources/activemq-client/**/openwire/OpenWireUtil.java</exclude>
                            </excludes>
                            <token>javax.jms</token>
                            <value>jakarta.jms</value>
                            <regexFlags>
                                <regexFlag>MULTILINE</regexFlag>
                            </regexFlags>
                        </configuration>
                    </execution>
                    <!-- Special case to handle OpenWireUtil which will do conversions for JMS exception types -->
                    <execution>
                        <id>jms-package-to-replace</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>${project.build.directory}/copied-sources/activemq-client/**/openwire/OpenWireUtil.java</include>
                            </includes>
                            <token>jmsPackageToReplace = "jakarta.jms"</token>
                            <value>jmsPackageToReplace = "javax.jms"</value>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jms-package-to-use</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>${project.build.directory}/copied-sources/activemq-client/**/openwire/OpenWireUtil.java</include>
                            </includes>
                            <token>jmsPackageToUse = "javax.jms"</token>
                            <value>jmsPackageToUse = "jakarta.jms"</value>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-java-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.build.directory}/copied-sources/activemq-client/org</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-resources/META-INF</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.build.directory}/copied-sources/activemq-client/META-INF</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-resource</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                          <resources>
                            <resource>
                              <directory>${project.build.directory}/generated-resources</directory>
                            </resource>
                          </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <inherited>true</inherited>
                <configuration>
                    <instructions>
                        <Import-Package>
                            !java.*,
                            !com.google.errorprone.annotations,
                            !com.google.errorprone.annotations.concurrent,
                            com.thoughtworks.xstream.*;resolution:="optional",
                            *
                        </Import-Package>
                        <Private-Package>
                            com.google.errorprone.annotations,
                            com.google.errorprone.annotations.concurrent
                        </Private-Package>
                        <_noee>true</_noee>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
