<?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.openwebbeans</groupId>
        <artifactId>openwebbeans</artifactId>
        <version>1.2.1</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>openwebbeans-cdi11-preview</artifactId>
    <name>OpenWebBeans Core for CDI 1.1 (preview)</name>
    <description>
        Apache OpenWebBeans Implementation core module implementing cdi 1.1 (preview)
    </description>


    <properties>
        <cdi11-tck.version>1.1.0.SP2</cdi11-tck.version>
    </properties>


    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-el_2.2_spec</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.xbean</groupId>
            <artifactId>xbean-finder-shaded</artifactId>
        </dependency>

        <dependency>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>javax.annotation</groupId>
          <artifactId>javax.annotation-api</artifactId>
          <version>1.2</version>
        </dependency>
        <dependency>
          <groupId>javax.ejb</groupId>
          <artifactId>javax.ejb-api</artifactId>
          <version>3.2</version>
        </dependency>            
        <!--    
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jcdi_1.1_spec</artifactId>
            <optional>true</optional>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-annotation_1.2_spec</artifactId>
            <version>1.0.MR2-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-ejb_3.2_spec</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        -->
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-servlet_3.0_spec</artifactId>
            <version>1.0</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.openwebbeans</groupId>
            <artifactId>openwebbeans-spi</artifactId>
        </dependency>

        <!--
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-interceptor_1.1_spec</artifactId>
            <optional>true</optional>
        </dependency>
        -->
        <dependency>
            <groupId>org.jboss.spec.javax.interceptor</groupId>
            <artifactId>jboss-interceptors-api_1.2_spec</artifactId>
            <version>1.0.0.Alpha1</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <!--
            additionally create a jar with all the test classes for use
            in the TCK module
        -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.7</version>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.openwebbeans</groupId>
                                    <artifactId>openwebbeans-impl</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>sources</classifier>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.2</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>                   
                    </execution>
                </executions>
                <configuration>
                    <basedir>${basedir}</basedir>
                    <preserveDir>true</preserveDir>
                    <includes>
                        <include>target/generated-sources/**/*.java</include>
                    </includes>
                    <replacements>
                        <replacement>
                            <token>import org.apache.webbeans.component.spi.BeanAttributes</token>
                            <value>import javax.enterprise.inject.spi.BeanAttributes</value>
                        </replacement>         
                        <replacement>
                            <token>import org.apache.webbeans.component.spi.ProducerFactory</token>
                            <value>import javax.enterprise.inject.spi.ProducerFactory</value>
                        </replacement>       
                        <replacement>
                            <token>import org.apache.webbeans.component.spi.InjectionTargetFactory</token>
                            <value>import javax.enterprise.inject.spi.InjectionTargetFactory</value>
                        </replacement>         
                        <replacement>
                            <token>import org.apache.webbeans.exception.inject.DefinitionException</token>
                            <value>import javax.enterprise.inject.spi.DefinitionException</value>
                        </replacement>         
                        <replacement>
                            <token>import org.apache.webbeans.exception.inject.DeploymentException</token>
                            <value>import javax.enterprise.inject.spi.DeploymentException</value>
                        </replacement>         
                        <replacement>
                            <token>import org.apache.webbeans.annotation.Intercepted</token>
                            <value>import javax.enterprise.inject.Intercepted</value>
                        </replacement>
                        <replacement>
                            <token>import org.apache.webbeans.annotation.Decorated</token>
                            <value>import javax.enterprise.inject.Decorated</value>
                        </replacement>
                        <replacement>
                            <token>import org.apache.webbeans.intercept.annotation.AroundConstruct</token>
                            <value>import javax.interceptor.AroundConstruct</value>
                        </replacement>
                        <replacement>
                            <token>import org.apache.webbeans.intercept.annotation.Priority</token>
                            <value>import javax.annotation.Priority</value>
                        </replacement>
                    </replacements>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <configuration>
                    <sources>
                        <source>${project.build.directory}/generated-sources</source>
                    </sources>
                    <resources>
                        <resource>
                            <directory>${project.build.directory}/generated-sources</directory>
                            <targetPath>${project.build.outputDirectory}</targetPath>
                            <excludes>
                                <exclude>**/*.java</exclude>
                            </excludes>
                        </resource>
                    </resources>
                </configuration>
                <executions>
                    <execution>
                        <id>add-sources</id>
                        <goals>
                            <goal>add-source</goal>
                            <goal>add-resource</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>run-its</id>
            <build>
                <plugins>
                    <!-- invoke the integration tests under src/it -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <configuration>
                            <debug>true</debug>
                            <projectsDirectory>src/it</projectsDirectory>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <pomIncludes>
                                <pomInclude>*/pom.xml</pomInclude>
                            </pomIncludes>
                            <goals>
                                <goal>install</goal>
                            </goals>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>tck11</id>

            <dependencies>
                <dependency>
                    <groupId>org.jboss.cdi.tck</groupId>
                    <artifactId>cdi-tck-api</artifactId>
                    <version>${cdi11-tck.version}</version>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>javax.enterprise</groupId>
                            <artifactId>cdi-api</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>javax.el</groupId>
                            <artifactId>el-api</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.jboss.cdi.tck</groupId>
                    <artifactId>cdi-tck-impl</artifactId>
                    <version>${cdi11-tck.version}</version>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>javax.enterprise</groupId>
                            <artifactId>cdi-api</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>javax.faces</groupId>
                            <artifactId>jsf-api</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>javax.servlet</groupId>
                            <artifactId>javax.servlet-api</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>javax.servlet.jsp</groupId>
                            <artifactId>jsp-api</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>javax.transaction</groupId>
                            <artifactId>jta</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-api</artifactId>
                    <version>2.1.11</version>
                </dependency>

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


                <dependency>
                    <groupId>org.apache.xbean</groupId>
                    <artifactId>xbean-finder-shaded</artifactId>
                </dependency>

                <dependency>
                    <groupId>org.testng</groupId>
                    <artifactId>testng</artifactId>
                    <version>6.3</version>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>org.apache.openwebbeans</groupId>
                    <artifactId>openwebbeans-spi</artifactId>
                </dependency>


                <dependency>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-jsp_2.2_spec</artifactId>
                    <version>1.1</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-jta_1.1_spec</artifactId>
                    <version>1.1.1</version>
                    <scope>test</scope>
                </dependency>

            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludedGroups>integration,javaee-full</excludedGroups>
                            <suiteXmlFiles>
                                <suiteXmlFile>standalone-suite.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-tck</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>

                                        <!-- OWB Porting Package -->
                                        <artifactItem>
                                            <groupId>org.apache.openwebbeans</groupId>
                                            <artifactId>openwebbeans-porting</artifactId>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                                        </artifactItem>

                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
