<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>com.vaadin</groupId>
        <artifactId>vaadin-parent</artifactId>
        <version>1.1.0</version>
    </parent>
    <!-- Do not remove explicit groupId even though Maven says this is redundant -->
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-cdi</artifactId>
    <version>3.0.1</version>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- In addition to POMs, these version numbers are in ArchiveProvider for tests -->
        <vaadin.version>8.4.3</vaadin.version>
        <deltaspike.version>1.7.2</deltaspike.version>

        <!-- Testing dependencies -->
        <selenium.version>2.53.0</selenium.version>
        <shiro.version>1.3.2</shiro.version>
        <arquillian.version>1.1.11.Final</arquillian.version>

        <!-- ZIP Manifest fields -->
        <Implementation-Version>${project.version}</Implementation-Version>
        <!-- Must not change this because of the Directory -->
        <Implementation-Title>Vaadin CDI</Implementation-Title>
        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
        <Vaadin-License-Title>Apache License 2.0</Vaadin-License-Title>
        <Vaadin-Addon>vaadin-cdi-${project.version}.jar</Vaadin-Addon>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>vaadin-snapshots</id>
            <name>Vaadin snapshot repository</name>
            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>vaadin-snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots</url>
        </repository>
        <!-- TODO: Remove when going final -->
        <repository>
            <id>vaadin-prereleases</id>
            <url>http://maven.vaadin.com/vaadin-prereleases</url>
        </repository>
    </repositories>

    <name>vaadin-cdi</name>
    <url>http://vaadin.com</url>
    <description>Provides CDI integration for Vaadin projects</description>

    <organization>
        <name>Vaadin Ltd</name>
        <url>http://vaadin.com</url>
    </organization>
    <scm>
        <url>https://github.com/vaadin/cdi</url>
        <connection>git:https://github.com/vaadin/cdi.git</connection>
        <developerConnection>git:https://github.com/vaadin/cdi.git</developerConnection>
    </scm>
    <issueManagement>
        <system>trac</system>
        <url>http://dev.vaadin.com/</url>
    </issueManagement>

    <developers>
        <developer>
            <name>Peter Lehto</name>
        </developer>
        <developer>
            <name>Adam Bien</name>
        </developer>
        <developer>
            <name>Henri Sara</name>
        </developer>
        <developer>
            <name>Jonatan Kronqvist</name>
        </developer>
        <developer>
            <name>Juuso Valli</name>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>Apache License version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.1.2</version>
                        <configuration>
                            <excludeResources>true</excludeResources>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.9</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.2.1</version>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>assembly/assembly.xml</descriptor>
                            </descriptors>
                            <attach>false</attach>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>install</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>prerelease</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.1.2</version>
                        <configuration>
                            <excludeResources>true</excludeResources>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.9</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.2.1</version>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>assembly/assembly.xml</descriptor>
                            </descriptors>
                            <attach>false</attach>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>install</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>tomee</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <!-- Embedded TomEE -->
                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>arquillian-tomee-embedded</artifactId>
                    <version>7.0.2</version>
                    <scope>test</scope>
                </dependency>
                <!-- Java EE 6 API. Must be last to be overridden by tomee for
                     the test phase -->
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>6.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>tomee-cluster</id>
            <dependencies>
                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>arquillian-tomee-remote</artifactId>
                    <version>7.0.2</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>apache-tomee</artifactId>
                    <version>7.0.2</version>
                    <classifier>webprofile</classifier>
                    <type>zip</type>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>7.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <forkMode>always</forkMode>
                            <systemPropertyVariables>
                                <arquillian.launch>tomee-cluster</arquillian.launch>
                            </systemPropertyVariables>
                            <groups>com.vaadin.cdi.ClusterTestCategory</groups>
                            <excludedGroups>com.vaadin.cdi.NoneTestCategory</excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>wildfly-cluster</id>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <version>2.0.0.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>7.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-node1</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <type>zip</type>
                                            <outputDirectory>target/wildfly-node1</outputDirectory>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <type>zip</type>
                                            <outputDirectory>target/wildfly-node2</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <arquillian.launch>wildfly-cluster</arquillian.launch>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            </systemPropertyVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                            <groups>com.vaadin.cdi.ClusterTestCategory</groups>
                            <excludedGroups>com.vaadin.cdi.NoneTestCategory</excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>wildfly</id>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <version>2.0.0.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>7.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <type>zip</type>
                                            <outputDirectory>target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <forkMode>always</forkMode>
                            <systemPropertyVariables>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                                <jboss.home>${project.build.directory}/wildfly-10.1.0.Final</jboss.home>
                            </systemPropertyVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>glassfish</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-managed-3.1</artifactId>
                    <version>1.0.0.Final</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>7.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.glassfish.main.distributions</groupId>
                                            <artifactId>glassfish</artifactId>
                                            <version>4.1.1</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <forkMode>always</forkMode>
                            <environmentVariables>
                                <GLASSFISH_HOME>${project.build.directory}/glassfish4</GLASSFISH_HOME>
                            </environmentVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${arquillian.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.selenium</groupId>
                <artifactId>selenium-bom</artifactId>
                <version>${selenium.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-dist</artifactId>
                <version>10.1.0.Final</version>
                <type>zip</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- Compile dependencies -->

        <!-- vaadin core -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>${vaadin.version}</version>
            <scope>compile</scope>
        </dependency>

        <!-- DeltaSpike -->
        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-api</artifactId>
            <version>${deltaspike.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-impl</artifactId>
            <version>${deltaspike.version}</version>
            <scope>runtime</scope>
        </dependency>

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

        <!-- Test dependencies -->
        <!-- Arquillian -->
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.descriptors</groupId>
            <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Graphene -->
        <dependency>
            <groupId>org.jboss.arquillian.graphene</groupId>
            <artifactId>graphene-webdriver</artifactId>
            <type>pom</type>
            <version>2.1.0.Final</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.enterprise</groupId>
                    <artifactId>cdi-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Unit testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>
        <!-- vaadin dependencies needed for integration testing -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
            <version>${vaadin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
            <version>${vaadin.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- shiro dependencies needed for integration testing -->
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-core</artifactId>
            <version>${shiro.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-web</artifactId>
            <version>${shiro.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- undertow core for clustering test reverse proxy -->
        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-core</artifactId>
            <version>1.4.8.Final</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addClasspath>false</addClasspath>
                            <!-- Implementation-Title and Implementation-Version come from the
                                POM by default -->
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Title>${Implementation-Title}</Implementation-Title>
                            <!-- Package format version - do not change -->
                            <Vaadin-Package-Version>1</Vaadin-Package-Version>

                            <Vaadin-License-Title>${Vaadin-License-Title}</Vaadin-License-Title>
                        </manifestEntries>
                    </archive>
                    <!-- exclude other META-INF data under build directory -->
                    <includes>
                        <include>META-INF/maven/${project.groupId}/${project.artifactId}/**</include>
                        <include>com/**</include>
                        <include>META-INF/services/**</include>
                        <include>META-INF/beans.xml</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <!-- Assertions must be disabled when @UIScoped is a @NormalScope
                        otherwise the core framework will fail assertions that compare
                        a direct reference to a proxy, such as in VaadinSession#removeUI
                        and ConnectorTracker#cleanConnectorMap (#14508) -->
                    <enableAssertions>false</enableAssertions>
                    <!-- Fork every test because it will launch a separate AS instance -->
                    <forkMode>always</forkMode>
                    <systemPropertyVariables>
                        <javax.el.ExpressionFactory>org.apache.el.ExpressionFactoryImpl</javax.el.ExpressionFactory>
                    </systemPropertyVariables>
                    <redirectTestOutputToFile>false</redirectTestOutputToFile>
                    <excludedGroups>com.vaadin.cdi.ClusterTestCategory</excludedGroups>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <enableRulesSummary>false</enableRulesSummary>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <configLocation>checkstyle/vaadin-checkstyle.xml</configLocation>
                    <violationSeverity>error</violationSeverity>
                    <headerLocation>checkstyle/header</headerLocation>
                </configuration>
            </plugin>

        </plugins>

    </build>

</project>
