<?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-all-parent</artifactId>
      <version>8.2.2.Final</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-embedded</artifactId>
   <packaging>jar</packaging>
   <name>Infinispan Embedded</name>
   <description>Infinispan Embedded All-in-One module</description>

   <properties>
      <intermediary_jar_name>intermediary-${project.build.finalName}</intermediary_jar_name>
      <intermediary_jar_path>${project.build.directory}/${intermediary_jar_name}.jar</intermediary_jar_path>
   </properties>

   <dependencies>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-commons</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jdbc</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jpa</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-leveldb</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-remote</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-query-dsl</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-remote-query-client</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cdi-embedded</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-jcache</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.jgroups</groupId>
         <artifactId>jgroups</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.jboss.marshalling</groupId>
         <artifactId>jboss-marshalling-osgi</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>org.jboss.spec.javax.transaction</groupId>
         <artifactId>jboss-transaction-api_1.1_spec</artifactId>
      </dependency>

      <dependency>
         <groupId>javax.cache</groupId>
         <artifactId>cache-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <scope>provided</scope>
      </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.jboss.modules</groupId>
         <artifactId>jboss-modules</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>

      <dependency>
         <groupId>com.mchange</groupId>
         <artifactId>c3p0</artifactId>
         <optional>${uberjar.deps.optional}</optional>
      </dependency>
   </dependencies>

   <build>
      <finalName>${project.artifactId}-${project.version}</finalName>
      <resources>
         <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
               <include>features.xml</include>
               <include>OSGI-INF/blueprint/blueprint.xml</include>
            </includes>
         </resource>
      </resources>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
               <execution>
                  <id>none-default</id>
                  <phase>package</phase>
                  <goals>
                     <goal>shade</goal>
                  </goals>
                  <configuration>
                     <finalName>${intermediary_jar_name}</finalName>
                     <artifactSet>
                        <excludes>
                           <exclude>org.infinispan:infinispan-embedded</exclude>
                           <exclude>org.fusesource.hawtjni:hawtjni-runtime:jar:</exclude>
                           <exclude>org.fusesource.leveldbjni:leveldbjni:jar:</exclude>
                           <exclude>org.iq80.leveldb:leveldb-api:jar:</exclude>
                           <exclude>org.apache.logging.log4j:log4j-core:jar:*</exclude>
                           <exclude>log4j:log4j:jar:*</exclude>
                           <exclude>net.jcip:jcip-annotations:jar:</exclude>
                           <exclude>org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:</exclude>
                           <exclude>org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:</exclude>
                           <exclude>javax.annotation:jsr250-api:jar:</exclude>
                           <exclude>javax.cache:cache-api:jar:</exclude>
                           <exclude>javax.enterprise:cdi-api:jar:</exclude>
                           <exclude>javax.inject:javax.inject:jar:</exclude>
                           <exclude>org.osgi:org.osgi.core:jar:</exclude>
                           <exclude>org.osgi:org.osgi.compendium:jar:</exclude>
                           <exclude>com.google.code.findbugs:jsr305:jar:</exclude>
                        </excludes>
                     </artifactSet>
                     <filters>
                        <filter>
                           <artifact>org.infinispan:infinispan-cdi-embedded</artifact>
                           <excludes>
                              <exclude>META-INF/beans.xml</exclude>
                           </excludes>
                        </filter>
                        <filter>
                           <artifact>org.infinispan.protostream:protostream</artifact>
                           <excludes>
                              <exclude>protostream/javassist/util/HotSwapper*.class</exclude>
                           </excludes>
                        </filter>
                        <filter>
                           <artifact>org.jgroups:jgroups</artifact>
                           <includes>
                              <include>org/jgroups/**</include>
                              <include>jg-magic-map.xml</include>
                              <include>jg-protocol-ids.xml</include>
                              <include>*.properties</include>
                              <include>*.xsd</include>
                           </includes>
                        </filter>
                        <filter>
                           <artifact>org.jboss.logging:jboss-logging</artifact>
                           <excludes>
                              <exclude>org/jboss/logging/JBossLogManagerLogger*.class</exclude>
                              <exclude>org/jboss/logging/JBossLogManagerProvider*.class</exclude>
                           </excludes>
                        </filter>
                        <filter>
                           <artifact>org.infinispan:infinispan-commons</artifact>
                           <excludes>
                              <exclude>org/infinispan/commons/util/OsgiClassLoader*.class</exclude>
                           </excludes>
                        </filter>
                        <filter>
                           <artifact>com.mchange:mchange-commons-java</artifact>
                           <excludes>
                              <exclude>com/mchange/v3/hocon/*</exclude>
                           </excludes>
                        </filter>
                        <filter>
                           <artifact>*:*</artifact>
                           <excludes>
                              <exclude>INSTALL.html</exclude>
                              <exclude>LICENSE</exclude>
                              <exclude>XPP3-LICENSE.txt</exclude>
                              <exclude>README</exclude>
                              <exclude>META-INF/*.SF</exclude>
                              <exclude>META-INF/*.DSA</exclude>
                              <exclude>META-INF/*.RSA</exclude>
                              <exclude>META-INF/ASL2.0</exclude>
                              <exclude>META-INF/DEPENDENCIES</exclude>
                              <exclude>META-INF/DEPENDENCIES.txt</exclude>
                              <exclude>META-INF/LICENSE</exclude>
                              <exclude>META-INF/LICENSE.txt</exclude>
                              <exclude>META-INF/NOTICE</exclude>
                              <exclude>META-INF/NOTICE.txt</exclude>
                              <exclude>schema/*.xsd</exclude>
                              <exclude>__redirected/*</exclude>
                           </excludes>
                        </filter>
                     </filters>
                     <createSourcesJar>true</createSourcesJar>
                     <relocations>
                        <relocation>
                           <pattern>com.google</pattern>
                           <shadedPattern>infinispan.com.google</shadedPattern>
                        </relocation>
                        <relocation>
                           <pattern>com.mchange</pattern>
                           <shadedPattern>infinispan.com.mchange</shadedPattern>
                        </relocation>
                        <relocation>
                           <pattern>org.iq80</pattern>
                           <shadedPattern>infinispan.org.iq80</shadedPattern>
                        </relocation>
                        
                        
                     </relocations>
                     <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                           <resources>
                              <resource>features.xml</resource>
                           </resources>
                        </transformer>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                     </transformers>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.4.0</version>
            <executions>
               <execution>
                  <id>default-bundle</id>
                  <phase>none</phase>
                  <goals>
                     <goal>bundle</goal>
                  </goals>
               </execution>
               <execution>
                  <id>bundle-package</id>
                  <phase>package</phase>
                  <goals>
                     <goal>bundle</goal>
                  </goals>
                  <configuration>
                     <instructions>
                        <Include-Resource>
                           @${intermediary_jar_path},
                           /OSGI-INF/blueprint/blueprint.xml=${project.basedir}/target/classes/OSGI-INF/blueprint/blueprint.xml,
                           /features.xml=${project.basedir}/target/classes/features.xml
                        </Include-Resource>
                        <_exportcontents>
                           org.infinispan.*,
                           org.jboss.marshalling.*;version=${version.jboss.marshalling},
                           org.jgroups.*;version=${version.jgroups},
                        </_exportcontents>
                        <Import-Package>
                           !com.mchange.v2.c3p0,
                           !com.sun.jmx.mbeanserver,
                           !infinispan.*,
                           !javax.cache.*,
                           !javax.enterprise.*,
                           !javax.inject.*,
                           !javax.interceptor.*,
                           !javax.persistence.*,
                           !net.jcip.annotations,
                           !org.apache.logging.*,
                           !org.hibernate.*,
                           !org.infinispan.*,
                           !org.infinispan.client.*,
                           !org.jgroups.*,
                           !org.jboss.logmanager,
                           !org.jboss.modules,
                           !org.iq80.snappy,
                           !org.jboss.marshalling.*,
                           !org.xerial.snappy,
                           !sun.misc,
                           !sun.reflect,
                           !sun.nio.ch,
                           *
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <Dependencies>org.hibernate</Dependencies>
                     </instructions>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.8</version>
            <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>
                        <artifact>
                           <file>target/${project.build.finalName}-shaded-sources.jar</file>
                           <type>jar</type>
                           <classifier>sources</classifier>
                        </artifact>
                     </artifacts>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.3</version>
            <executions>
               <execution>
                  <id>attach-sources</id>
                  <phase>none</phase>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <executions>
               <execution>
                  <id>build-test-jar</id>
                  <phase>none</phase>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>

</project>