<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.infinispan</groupId>
      <artifactId>infinispan-parent</artifactId>
      <version>9.4.3.Final</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-commons</artifactId>
   <packaging>jar</packaging>
   <name>Infinispan Commons</name>
   <description>Infinispan Commons</description>

   <dependencies>
      <dependency>
         <groupId>com.github.ben-manes.caffeine</groupId>
         <artifactId>caffeine</artifactId>
      </dependency>

      <dependency>
         <groupId>org.jboss.logging</groupId>
         <artifactId>jboss-logging</artifactId>
      </dependency>

      <dependency>
         <groupId>org.jboss.spec.javax.transaction</groupId>
         <artifactId>jboss-transaction-api_1.2_spec</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.marshalling</groupId>
         <artifactId>jboss-marshalling-osgi</artifactId>
         <optional>true</optional>
      </dependency>

      <dependency>
         <groupId>org.osgi</groupId>
         <artifactId>org.osgi.core</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.osgi</groupId>
         <artifactId>org.osgi.compendium</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
        <groupId>org.apache.karaf.features</groupId>
        <artifactId>framework</artifactId>
        <type>kar</type>
        <scope>provided</scope>
        <exclusions>
          <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-commons-test</artifactId>
         <scope>test</scope>
      </dependency>

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

   <build>
      <resources>
         <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
               <include>features.xml</include>
            </includes>
         </resource>
         <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>false</filtering>
            <includes>
               <include>**/*</include>
            </includes>
            <excludes>
               <exclude>features.xml</exclude>
            </excludes>
         </resource>
      </resources>
      <plugins>
         <!-- compiler to use -XDignore.symbol.file to suppress warnings regarding the use of sun.misc.Unsafe -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <compilerArgument combine.children="append">-XDignore.symbol.file</compilerArgument>
               <!-- Forking is necessary to allow for the compiler args to be picked up. -->
               <fork combine.children="append">true</fork>
               <source>1.8</source>
               <target>1.8</target>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <parallel>classes</parallel>
               <groups combine.self="override">${defaultJUnitGroups}</groups>
               <excludedGroups combine.self="override">${defaultExcludedJUnitGroups}</excludedGroups>
               <systemPropertyVariables combine.self="override">
                  <log4j.configurationFile>${log4j.configurationFile}</log4j.configurationFile>
                  <build.directory>${project.build.directory}</build.directory>
               </systemPropertyVariables>
               <properties combine.self="override">
                  <usedefaultlisteners>false</usedefaultlisteners>
                  <listener>${junitListener}</listener>
               </properties>
               <disableXmlReport>false</disableXmlReport>
            </configuration>
            <dependencies>
               <dependency>
                  <groupId>org.apache.maven.surefire</groupId>
                  <artifactId>surefire-junit47</artifactId>
                  <version>${version.maven.surefire}</version>
               </dependency>
            </dependencies>
         </plugin>

         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>attach-artifacts</id>
                  <phase>package</phase>
                  <goals>
                     <goal>attach-artifact</goal>
                  </goals>
                  <configuration>
                     <artifacts>
                        <artifact>
                           <file>target/classes/features.xml</file>
                           <type>xml</type>
                           <classifier>features</classifier>
                        </artifact>
                     </artifacts>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>false</extensions>
            <configuration>
               <instructions>
                  <Bundle-DocURL>http://www.infinispan.org/</Bundle-DocURL>
                  <!-- Required for loading client classes. -->
                  <DynamicImport-Package>*</DynamicImport-Package>
                  <Export-Package>
                     ${project.groupId}.commons.*;version=${project.version};-split-package:=error,
                     ${project.groupId}.counter.*;version=${project.version};-split-package:=error,
                     ${project.groupId}.multimap.*;version=${project.version};-split-package:=error
                  </Export-Package>
                  <!-- Relax the versioning rule for osgi packages as a specific version is provided by the container and
                       it might not match the one used to build. -->
                  <Import-Package><![CDATA[
                  !sun.misc,
                  !sun.reflect,
                  *
                  ]]>
                  </Import-Package>
                  <_consumer-policy>${bnd.consumer.policy}</_consumer-policy>
                  <_provider-policy>${bnd.provider.policy}</_provider-policy>
                  <Include-Resource>{maven-resources}</Include-Resource>
                  <Implementation-Build-Commit-Id>${buildNumber}</Implementation-Build-Commit-Id>
                  <Implementation-Build-Branch>${scmBranch}</Implementation-Build-Branch>
               </instructions>
            </configuration>
            <executions>
               <execution>
                  <id>versions</id>
                  <phase>validate</phase>
                  <goals>
                     <goal>cleanVersions</goal>
                  </goals>
                  <configuration>
                     <versions>
                        <infinispan.osgi.version.clean>${project.version}</infinispan.osgi.version.clean>
                     </versions>
                  </configuration>
               </execution>
               <execution>
                  <id>bundle-manifest</id>
                  <phase>prepare-package</phase>
                  <goals>
                     <goal>manifest</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
               <archive>
                  <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
               </archive>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.karaf.tooling</groupId>
            <artifactId>karaf-maven-plugin</artifactId>
            <configuration>
               <features>
                  <feature>infinispan-commons</feature>
               </features>
            </configuration>
         </plugin>
      </plugins>
   </build>

   <profiles>
      <profile>
         <id>smoke</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>default-test</id>
                        <phase>none</phase>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
</project>
