<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2009-2020 Roland Huss
  ~
  ~ 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>

  <artifactId>jolokia-client-jmx-adapter</artifactId>
  <version>2.6.2</version>
  <packaging>bundle</packaging>

  <name>jolokia-client-jmx-adapter</name>
  <description>Jolokia :: Client :: JMX Adapter</description>

  <parent>
    <groupId>org.jolokia</groupId>
    <artifactId>jolokia-parent</artifactId>
    <version>2.6.2</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <url>https://jolokia.org/</url>

  <dependencies>

    <!-- Jolokia own artifacts -->

    <dependency>
      <groupId>org.jolokia</groupId>
      <artifactId>jolokia-json</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jolokia</groupId>
      <artifactId>jolokia-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jolokia</groupId>
      <artifactId>jolokia-client-java</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jolokia</groupId>
      <artifactId>jolokia-tools-test</artifactId>
      <scope>test</scope>
    </dependency>

    <!--
      Test dependency on Jolokia Agent, so we have something to test the Jolokia JMX Connector Client on
    -->
    <dependency>
      <groupId>org.jolokia</groupId>
      <artifactId>jolokia-agent-jvm</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.jolokia</groupId>
          <artifactId>jolokia-server-detector</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jolokia</groupId>
          <artifactId>jolokia-service-discovery</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jolokia</groupId>
          <artifactId>jolokia-service-jsr160</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jolokia</groupId>
          <artifactId>jolokia-service-notif-pull</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jolokia</groupId>
          <artifactId>jolokia-service-notif-sse</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>org.jolokia.client.jmx-adapter</Bundle-SymbolicName>
            <Bundle-Description>Jolokia JMX adapter</Bundle-Description>
            <Import-Package>
              <!-- JDK -->
              javax.management,
              javax.management.openmbean,
              javax.management.remote,
              javax.security.auth,
              <!-- jolokia-json -->
              org.jolokia.json;version="[2.5,3)",
              <!-- jolokia-core -->
              org.jolokia.converter.json;version="[2.5,3)",
              org.jolokia.converter.object;version="[2.5,3)",
              org.jolokia.core.config;version="[2.5,3)",
              org.jolokia.core.util;version="[2.5,3)",
              <!-- jolokia-client-java -->
              org.jolokia.client;version="[2.5,3)",
              org.jolokia.client.exception;version="[2.5,3)",
              org.jolokia.client.request;version="[2.5,3)",
              org.jolokia.client.response;version="[2.5,3)"
            </Import-Package>
            <Export-Package>
              org.jolokia.client.jmxadapter
            </Export-Package>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <minimizeJar>false</minimizeJar>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <shadedClassifierName>standalone</shadedClassifierName>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <artifactSet>
                <includes>
                  <include>org.jolokia:jolokia-json</include>
                  <include>org.jolokia:jolokia-core</include>
                  <include>org.jolokia:jolokia-client-java</include>
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>org.jolokia:jolokia-json</artifact>
                  <excludes>
                    <exclude>META-INF/*.MF</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>org.jolokia:jolokia-core</artifact>
                  <excludes>
                    <exclude>META-INF/*.MF</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>org.jolokia:jolokia-client-java</artifact>
                  <excludes>
                    <exclude>META-INF/*.MF</exclude>
                  </excludes>
                </filter>
              </filters>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/jolokia/services-default</resource>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <reuseForks>false</reuseForks>
          <forkCount>1</forkCount>
          <!-- for IJ: https://www.jetbrains.com/help/idea/running-tests.html -->
          <argLine>
            -Djava.util.logging.config.file=target/test-classes/logging.properties
            <!-- We used to need these properties in surefire configuration, but now we control the RMI Connector programmatically -->
<!--            -Dcom.sun.management.jmxremote-->
<!--            -Dcom.sun.management.jmxremote.port=45888-->
<!--            -Dcom.sun.management.jmxremote.authenticate=false-->
<!--            -Dcom.sun.management.jmxremote.ssl=false-->
<!--            -Djava.rmi.server.hostname=localhost-->
          </argLine>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
