<?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.camel</groupId>
    <artifactId>components</artifactId>
    <version>2.25.4</version>
  </parent>

  <artifactId>camel-cdi</artifactId>
  <packaging>jar</packaging>
  <name>Camel :: CDI</name>
  <description>Using Camel with CDI</description>

  <properties>
    <!-- use by camel-catalog -->
    <firstVersion>2.10.0</firstVersion>
    <label>java</label>
    <title>CDI</title>

    <camel.osgi.import>
      !org.apache.camel.cdi.*,
      !org.apache.deltaspike.cdise.api.*,
      ${camel.osgi.import.defaults},
      *
    </camel.osgi.import>
    <camel.osgi.export.pkg>
      org.apache.camel.cdi;${camel.osgi.version}
    </camel.osgi.export.pkg>
    <camel.osgi.provide.capability>
      org.ops4j.pax.cdi.extension; extension=camel-cdi-extension
    </camel.osgi.provide.capability>
  </properties>

  <dependencyManagement>
    <dependencies>

      <!-- test dependencies -->

      <dependency>
        <groupId>org.jboss.shrinkwrap.descriptors</groupId>
        <artifactId>shrinkwrap-descriptors-bom</artifactId>
        <version>${shrinkwrap-descriptors-version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${arquillian-version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <dependencies>

    <!-- compile dependencies -->

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>

    <!-- DeltaSpike is only used to provide Main support thus optional -->
    <dependency>
      <groupId>org.apache.deltaspike.cdictrl</groupId>
      <artifactId>deltaspike-cdictrl-api</artifactId>
      <version>${deltaspike-version}</version>
      <optional>true</optional>
    </dependency>

    <!-- provided dependencies -->

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core-xml</artifactId>
      <version>${project.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core-osgi</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <version>${osgi-version}</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>javax.transaction-api</artifactId>
      <version>${jta-api-1.2-version}</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <!-- test dependencies -->

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-context</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>java-hamcrest</artifactId>
      <version>${hamcrest-version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <version>${slf4j-version}</version>
      <scope>test</scope>
    </dependency>
        
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <version>${arquillian-version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.shrinkwrap.descriptors</groupId>
      <artifactId>shrinkwrap-descriptors-depchain</artifactId>
      <type>pom</type>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>weld-1.0</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*Cdi12Test.java</exclude>
                <exclude>**/*Cdi20Test.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <dependencies>

        <!-- provided dependencies -->

        <dependency>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
          <version>${cdi-api-1.0-version}</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>javax.el</groupId>
          <artifactId>javax.el-api</artifactId>
          <version>${javax.el-api-version}</version>
          <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-core</artifactId>
          <version>${weld1-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-weld-se-embedded-1.1</artifactId>
          <version>1.0.0.CR9</version>
          <scope>test</scope>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>weld-1.2</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*Cdi20Test.java</exclude>
                <!-- Reactivate when CAMEL-12834 is fixed -->
                <exclude>**/UnsatisfiedContextForEndpointInjectTest.java</exclude>
                <!-- Reactivate when CAMEL-12834 is fixed -->
                <exclude>**/UriWithWrongContextTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <dependencies>

        <!-- provided dependencies -->

        <dependency>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
          <version>${cdi-api-1.2-version}</version>
          <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-core-impl</artifactId>
          <version>${weld2-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-weld-embedded</artifactId>
          <version>${arquillian-weld-embedded-version}</version>
          <scope>test</scope>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>weld-2.0</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <!-- Reactivate when CAMEL-12834 is fixed -->
                <exclude>**/UnsatisfiedContextForEndpointInjectTest.java</exclude>
                <!-- Reactivate when CAMEL-12834 is fixed -->
                <exclude>**/UriWithWrongContextTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <dependencies>

        <!-- provided dependencies -->

        <dependency>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
          <version>${cdi-api-2.0-version}</version>
          <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-core-impl</artifactId>
          <version>${weld3-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-weld-embedded</artifactId>
          <version>${arquillian-weld-embedded-version}</version>
          <scope>test</scope>
        </dependency>

      </dependencies>
    </profile>


    <profile>
      <id>owb-1.0</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*Cdi12Test.java</exclude>
                <exclude>**/*Cdi20Test.java</exclude>
                <!-- OWB does not call the InjectionTarget#preDestroy method -->
                <exclude>**/UnstoppedCamelContext*Test.java</exclude>
                <!-- Reactivate when OWB-1155 is fixed -->
                <exclude>**/ProgrammaticLookupTest.java</exclude>
                <!-- Reactivate when OWB-1126 is fixed -->
                <exclude>**/Xml*Test.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <dependencies>

        <!-- provided dependencies -->

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>${geronimo-jcdi-1.0-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>${geronimo-atinject-1.0-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>${geronimo-interceptor-1.1-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
          <groupId>org.apache.openwebbeans.arquillian</groupId>
          <artifactId>owb-arquillian-standalone</artifactId>
          <version>${openwebbeans1-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-impl</artifactId>
          <version>${openwebbeans1-version}</version>
          <scope>test</scope>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>owb-1.2</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*Cdi20Test.java</exclude>
                <!-- Reactivate when OWB-1155 is fixed -->
                <exclude>**/ProgrammaticLookupTest.java</exclude>
                <!-- Reactivate when OWB-1126 is fixed -->
                <exclude>**/Xml*Test.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <dependencies>

        <!-- provided dependencies -->

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.1_spec</artifactId>
          <version>${geronimo-jcdi-1.1-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>${geronimo-atinject-1.0-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-annotation_1.2_spec</artifactId>
          <version>${geronimo-annotation-1.2-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.2_spec</artifactId>
          <version>${geronimo-interceptor-1.2-spec-version}</version>
          <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
          <groupId>org.apache.openwebbeans.arquillian</groupId>
          <artifactId>owb-arquillian-standalone</artifactId>
          <version>${openwebbeans-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-impl</artifactId>
          <version>${openwebbeans-version}</version>
          <scope>test</scope>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>jdk9+-weld-2.0</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>

      <dependencies>

        <!-- provided dependencies -->

        <dependency>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
          <version>${cdi-api-2.0-version}</version>
          <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-core-impl</artifactId>
          <version>${weld3-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-weld-embedded</artifactId>
          <version>${arquillian-weld-embedded-version}</version>
          <scope>test</scope>
        </dependency>

      </dependencies>

      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <reuseForks>true</reuseForks>
              <argLine>--patch-module java.xml.ws.annotation=${project.basedir}/target/java9/javax.annotation-api-1.2.jar --patch-module java.xml.bind=${project.basedir}/target/java9 ${camel.surefire.fork.vmargs} --add-opens java.base/java.lang=java.xml.bind</argLine>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
              <execution>
                <id>copy</id>
                <phase>validate</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>javax.annotation</groupId>
                      <artifactId>javax.annotation-api</artifactId>
                      <version>1.2</version>
                      <type>jar</type>
                      <overWrite>false</overWrite>
                      <outputDirectory>${project.basedir}/target/java9</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                  <overWriteReleases>false</overWriteReleases>
                  <overWriteSnapshots>true</overWriteSnapshots>
                </configuration>
              </execution>
              <execution>
                <id>copy-jaxb</id>
                <phase>validate</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.sun.xml.bind</groupId>
                      <artifactId>jaxb-impl</artifactId>
                      <version>${jaxb-version}</version>
                      <overWrite>false</overWrite>
                      <outputDirectory>${project.basedir}/target/java9</outputDirectory>
                    </artifactItem>
                    <artifactItem>
                      <groupId>com.sun.xml.bind</groupId>
                      <artifactId>jaxb-core</artifactId>
                      <version>${jaxb-version}</version>
                      <overWrite>false</overWrite>
                      <outputDirectory>${project.basedir}/target/java9</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                  <overWriteReleases>false</overWriteReleases>
                  <overWriteSnapshots>true</overWriteSnapshots>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
