<?xml version="1.0" encoding="UTF-8"?>
<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.glowroot.instrumentation</groupId>
    <artifactId>instrumentation-parent</artifactId>
    <version>0.14.3</version>
    <relativePath>../..</relativePath>
  </parent>

  <artifactId>instrumentation-spring</artifactId>

  <name>Instrumentation for Spring Framework</name>
  <description>Instrumentation for Spring Framework</description>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <spring.version>5.1.4.RELEASE</spring.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.glowroot.instrumentation</groupId>
      <artifactId>instrumentation-api</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.glowroot.instrumentation</groupId>
      <artifactId>instrumentation-test-harness</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.ning</groupId>
      <artifactId>async-http-client</artifactId>
      <!-- async-http-client 1.9.0+ requires Java 7+ -->
      <version>1.8.17</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-core</artifactId>
      <!-- tomcat 8.0.0+ requires Java 7+ -->
      <version>7.0.91</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-jasper</artifactId>
      <!-- tomcat 8.0.0+ requires Java 7+ -->
      <version>7.0.91</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-logging-juli</artifactId>
      <!-- tomcat 8.0.0+ requires Java 7+ -->
      <version>7.0.91</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-websocket</artifactId>
      <!-- tomcat 8.0.0+ requires Java 7+ -->
      <version>7.0.91</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <!-- this is needed because logback classic 1.1.10+ contains
        META-INF/services/javax.servlet.ServletContainerInitializer which causes issues when running
        tests with embedded tomcat inside JavaagentContainer because logback is loaded in the
        bootstrap class loader (see JavaagentContainer.java) and so
        LogbackServletContainerInitializer is loaded in the bootstrap class loader which then
        looks for ServletContainerInitializer in the bootstrap class loader, but it is not, and
        adding tomcat-embed-core (which has ServletContainerInitializer) to the bootstrap class
        loader causes NullPointerException in org.apache.catalina.startup.ContextConfig

        to get around this problem, javax.servlet-api artifact is included, and put in the bootstrap
        class loader (see JavaagentContainer.java) so that logback's ServletContainerInitializer
        can load in the the bootstrap class loader successfully
      -->
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <!-- Tomcat 7 (above) uses Servlet API 3.0 -->
      <version>3.0.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.java-websocket</groupId>
      <artifactId>Java-WebSocket</artifactId>
      <version>1.3.9</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <!-- servlet plugin is included to capture transactions -->
      <groupId>org.glowroot.instrumentation</groupId>
      <artifactId>instrumentation-servlet</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <!-- executor plugin is included to test async responses -->
      <groupId>org.glowroot.instrumentation</groupId>
      <artifactId>instrumentation-executor</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>test-java-6</id>
      <activation>
        <property>
          <name>test.java6</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <id>default-testCompile</id>
                <configuration>
                  <testExcludes>
                    <!-- Tomcat's websocket support requires Java 7 -->
                    <exclude>org/glowroot/instrumentation/spring/WebSocketIT.java</exclude>
                    <!-- just the presence of this class on classpath causes issues on some spring
                      versions due to https://jira.spring.io/browse/SPR-12238 -->
                    <exclude>org/glowroot/instrumentation/spring/WebSocketConfig.java</exclude>
                  </testExcludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spring-5.1.x</id>
      <activation>
        <property>
          <name>!test.noDefaultProfiles</name>
        </property>
      </activation>
      <properties>
        <spring.version>5.1.4.RELEASE</spring.version>
        <reactor.version>0.8.4.RELEASE</reactor.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webflux</artifactId>
          <version>${spring.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>io.projectreactor.netty</groupId>
          <artifactId>reactor-netty</artifactId>
          <version>${reactor.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <!-- netty plugin is required to capture webflux over netty -->
          <groupId>org.glowroot.instrumentation</groupId>
          <artifactId>instrumentation-netty</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-spring-5.1.x</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/test/spring-5.1.x/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spring-5.0.x</id>
      <properties>
        <spring.version>5.0.12.RELEASE</spring.version>
        <reactor.version>0.7.14.RELEASE</reactor.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webflux</artifactId>
          <version>${spring.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>io.projectreactor.ipc</groupId>
          <artifactId>reactor-netty</artifactId>
          <version>${reactor.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <!-- netty plugin is required to capture webflux over netty -->
          <groupId>org.glowroot.instrumentation</groupId>
          <artifactId>instrumentation-netty</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-spring-5.0.x</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/test/spring-5.0.x/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spring-4.0.1-and-later</id>
      <activation>
        <property>
          <name>!test.noDefaultProfiles</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-spring-4.0.1-and-later</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/test/spring-4.0.1-and-later/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spring-4.0.0</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-spring-4.0.0</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/test/spring-4.0.0/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spring-4.0.0-and-later</id>
      <activation>
        <property>
          <name>!test.noDefaultProfiles</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-websocket</artifactId>
          <version>${spring.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-messaging</artifactId>
          <version>${spring.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-spring-4.0.0-and-later</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/test/spring-4.0.0-and-later/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spring-3.2.0-and-later</id>
      <activation>
        <property>
          <name>!test.noDefaultProfiles</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-spring-3.2.0-and-later</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/test/spring-3.2.0-and-later/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
