<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.skywalking</groupId>
        <artifactId>apm-sniffer</artifactId>
        <version>8.3.0</version>
    </parent>

    <artifactId>apm-sdk-plugin</artifactId>
    <modules>
        <module>dubbo-plugin</module>
        <module>jdbc-commons</module>
        <module>httpClient-4.x-plugin</module>
        <module>jedis-2.x-plugin</module>
        <module>redisson-3.x-plugin</module>
        <module>tomcat-7.x-8.x-plugin</module>
        <module>motan-plugin</module>
        <module>mongodb-3.x-plugin</module>
        <module>mongodb-4.x-plugin</module>
        <module>feign-default-http-9.x-plugin</module>
        <module>okhttp-3.x-plugin</module>
        <module>spring-plugins</module>
        <module>struts2-2.x-plugin</module>
        <module>nutz-plugins</module>
        <module>jetty-plugin</module>
        <module>spymemcached-2.x-plugin</module>
        <module>sharding-jdbc-1.5.x-plugin</module>
        <module>sharding-sphere-3.x-plugin</module>
        <module>sharding-sphere-4.x-plugin</module>
        <module>sharding-sphere-4.x-RC3-plugin</module>
        <module>sharding-sphere-4.0.x-plugin</module>
        <module>sharding-sphere-4.1.0-plugin</module>
        <module>xmemcached-2.x-plugin</module>
        <module>grpc-1.x-plugin</module>
        <module>mysql-5.x-plugin</module>
        <module>mysql-6.x-plugin</module>
        <module>mysql-8.x-plugin</module>
        <module>mysql-common</module>
        <module>h2-1.x-plugin</module>
        <module>postgresql-8.x-plugin</module>
        <module>rocketMQ-3.x-plugin</module>
        <module>rocketMQ-4.x-plugin</module>
        <module>elastic-job-2.x-plugin</module>
        <module>elastic-job-3.x-plugin</module>
        <module>mongodb-2.x-plugin</module>
        <module>httpasyncclient-4.x-plugin</module>
        <module>kafka-commons</module>
        <module>kafka-plugin</module>
        <module>servicecomb-plugin</module>
        <module>hystrix-1.x-plugin</module>
        <module>sofarpc-plugin</module>
        <module>activemq-5.x-plugin</module>
        <module>elasticsearch-5.x-plugin</module>
        <module>elasticsearch-6.x-plugin</module>
        <module>undertow-plugins</module>
        <module>rabbitmq-5.x-plugin</module>
        <module>dubbo-conflict-patch</module>
        <module>canal-1.x-plugin</module>
        <module>dubbo-2.7.x-plugin</module>
        <module>dubbo-2.7.x-conflict-patch</module>
        <module>vertx-plugins</module>
        <module>resteasy-plugin</module>
        <module>solrj-7.x-plugin</module>
        <module>cassandra-java-driver-3.x-plugin</module>
        <module>light4j-plugins</module>
        <module>ehcache-2.x-plugin</module>
        <module>pulsar-plugin</module>
        <module>netty-socketio-plugin</module>
        <module>armeria-0.84.x-plugin</module>
        <module>armeria-0.85.x-plugin</module>
        <module>httpclient-3.x-plugin</module>
        <module>play-2.x-plugin</module>
        <module>lettuce-5.x-plugin</module>
        <module>avro-plugin</module>
        <module>finagle-6.25.x-plugin</module>
        <module>quasar-plugin</module>
        <module>mariadb-2.x-plugin</module>
        <module>influxdb-2.x-plugin</module>
        <module>baidu-brpc-plugin</module>
        <module>hbase-1.x-plugin</module>
        <module>graphql-plugin</module>
        <module>xxl-job-2.x-plugin</module>
        <module>thrift-plugin</module>
        <module>httpclient-commons</module>
        <module>asynchttpclient-2.x-plugin</module>
        <module>dbcp-2.x-plugin</module>
        <module>mssql-jtds-1.x-plugin</module>
        <module>mssql-jdbc-plugin</module>
        <module>cxf-3.x-plugin</module>
    </modules>
    <packaging>pom</packaging>

    <name>apm-sdk-plugin</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <sdk.plugin.related.dir />
        <shade.net.bytebuddy.source>net.bytebuddy</shade.net.bytebuddy.source>
        <shade.net.bytebuddy.target>${shade.package}.${shade.net.bytebuddy.source}</shade.net.bytebuddy.target>

        <agent.package.dest.dir>${project.build.directory}${sdk.plugin.related.dir}/../../../../skywalking-agent
        </agent.package.dest.dir>
        <plugin.dest.dir>${agent.package.dest.dir}/plugins</plugin.dest.dir>

        <ant-contrib.version>1.0b3</ant-contrib.version>
        <ant-nodeps.version>1.8.1</ant-nodeps.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.skywalking</groupId>
            <artifactId>apm-agent-core</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>${bytebuddy.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.skywalking</groupId>
            <artifactId>apm-util</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.skywalking</groupId>
            <artifactId>apm-test-tools</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>false</shadedArtifactAttached>
                            <createDependencyReducedPom>true</createDependencyReducedPom>
                            <createSourcesJar>true</createSourcesJar>
                            <shadeSourcesContent>true</shadeSourcesContent>
                            <relocations>
                                <relocation>
                                    <pattern>${shade.net.bytebuddy.source}</pattern>
                                    <shadedPattern>${shade.net.bytebuddy.target}</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.runtime.classpath" />
                                <if>
                                    <equals arg1="${project.packaging}" arg2="jar" />
                                    <then>
                                        <mkdir dir="${plugin.dest.dir}" />
                                        <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar" tofile="${plugin.dest.dir}/${project.artifactId}-${project.version}.jar" overwrite="true" />
                                    </then>
                                </if>

                            </tasks>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>${ant-contrib.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>ant</groupId>
                                <artifactId>ant</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.ant</groupId>
                        <artifactId>ant-nodeps</artifactId>
                        <version>${ant-nodeps.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>
