<?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.jena</groupId>
    <artifactId>apache-jena-osgi</artifactId>
    <version>3.8.0</version>
  </parent>
  <artifactId>jena-osgi</artifactId>  
  <packaging>bundle</packaging>
  <name>Apache Jena - OSGi bundle</name>
  <description>
    Embedding the main Jena modules (iri/core/arq/tdb) in a single OSGi bundle.
  </description>
  
  <!--
       Most of the job is done by maven-bundle-plugin (see below).
       It inspects the embedded/shadowed class files from jena-* to
       generate the correct Import/Export-Package statements.


       SCOPES:

       <scope>provided</scope> are explicitly picked up 
       by maven-bundle-plugin below to be shadowed within the bundle.  These
       are the non-OSGi bundles we want to package, e.g. Jena 
       and any dependencies that are not easily available as
       bundles..

       Those without <scope> (e.g. compile) below are already
       OSGi bundles and will become runtime dependencies of
       the jena-osgi bundle when used through Maven. Their
       transitive dependencies (e.g. jsonld-java depends on 
       jackson-core) are not explicitly listed here.

       Note that many OSGi users don't use Maven
       and would have to find those dependencies
       themselves. See ../jena-osgi-test/ for
       example.


       To avoid duplicates of non-bundle and bundle dependencies,
       e.g. httpcore vs. httpcore-osgi, there are several
       <excludes> below - as not everyone 
       follows the <scope>provided</scope> pattern.

       Use mvn dependency:tree to inspect what dependencies are
       exposed in the end, and unzip -t target/*.jar to inspect
       what becomes bundled in the bundle.

       Explore META-INF/MANFEST.MF in the jar to see what
       Import and Export the maven-bundle-plugin has figured out,
       usually the details figured out through code 
       introspections are correct - if verbose.

       -->
  <dependencies>
    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-arq</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
      <exclusions>
        <!-- These are all embedded within httpclient-osgi -->
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpmime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient-cache</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>fluent-hc</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    
    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-core</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-rdfconnection</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-shaded-guava</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-tdb</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-tdb2</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
    </dependency>
    <!--
    NOTE: Also update 
    src/main/resources/META-INF/services/org.apache.jena.sys.JenaSubsystemLifecycle
    to the concatenation of the different Jena modules' JenaSubsystemLifecycle
    (order does not matter). See JENA-1139 for details.
    -->

    <dependency>
      <groupId>org.apache.jena</groupId>
      <artifactId>jena-iri</artifactId>
      <version>3.8.0</version>
      <scope>provided</scope>
    </dependency>

    <!-- OSGi versions of Jena dependencies -->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient-osgi</artifactId>
      <version>${ver.httpclient-osgi}</version>
      <exclusions>
        <!-- These are all embedded within httpclient-osgi -->
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpmime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient-cache</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>fluent-hc</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpcore-osgi</artifactId>
      <version>${ver.httpcore-osgi}</version> 
      <exclusions>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpcore</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpcore-nio</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.github.jsonld-java</groupId>
      <artifactId>jsonld-java</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-csv</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
      <exclusions>
        <!-- Use httpclient-osgi instead -->
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpcore</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${ver.slf4j}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <version>5.0.0</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <!-- re-enable extensions here for older Mavens -->
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Export-Package>org.apache.jena.*,!org.apache.jena.ext.*</Export-Package>            
            <Embed-Dependency>artifactId=jena*;inline=true</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Import-Package>
              org.osgi.framework.*,
              !sun.io,
              !org.apache.avalon.framework.logger,
              !com.ibm.uvm.tools,
              !com.sun.jdmk.comm,
              !org.apache.log,
              !org.apache.jena.ext.*,
              !org.checkerframework.checker.*,
              !com.google.errorprone.annotations.*,
              sun.misc;resolution:=optional,
              *
            </Import-Package>
            <!--
            <Import-Package>org.osgi.framework.*,!sun.io,!org.apache.avalon.framework.logger,!com.ibm.uvm.tools,!com.sun.jdmk.comm,!org.apache.log,!org.apache.xml.*,!org.apache.jena.ext.*,sun.misc;resolution:=optional,*</Import-Package>
            -->
            <Private-Package>org.apache.jena.ext.*</Private-Package>
            <Bundle-Activator>org.apache.jena.osgi.Activator</Bundle-Activator>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
