<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
    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.sling</groupId>
        <artifactId>sling</artifactId>
        <version>8</version>
        <relativePath>../../../parent/pom.xml</relativePath>
    </parent>

    <artifactId>org.apache.sling.jcr.jackrabbit.server</artifactId>
    <packaging>jar</packaging>
    <version>2.0.6</version>

    <name>Apache Sling Jackrabbit Embedded Repository</name>
    <description>
        Bundle providing support to embed Jackrabbit Repository
        instances and publish via RMI and/or JNDI
    </description>

    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.jackrabbit.server-2.0.6</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.jackrabbit.server-2.0.6</developerConnection>
        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.jcr.jackrabbit.server-2.0.6</url>
    </scm>

    <build>
        <plugins>
            <!-- generate the SCR descriptors -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            
            <!--
                copy the SCR descriptors into the correct location
                because the maven-scr-plugin cannot be configured
                to write the descriptors elsewhere
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                  <execution>
                    <id>copy-resources</id>
                    <phase>process-classes</phase>
                    <goals>
                      <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                      <outputDirectory>
                        ${project.build.outputDirectory}
                      </outputDirectory>
                      <encoding>UTF-8</encoding>
                      <resources>          
                        <resource>
                          <directory>target/scr-plugin-generated</directory>
                          <filtering>false</filtering>
                        </resource>
                      </resources>              
                    </configuration>            
                  </execution>
                </executions>
            </plugin>
            
            <!--
                copy the embedded libraries required for the embedded
                Jackrabbit Repository
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>embed-dependencies</id>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>
                                jackrabbit-jcr-rmi,jackrabbit-core,jackrabbit-jcr-commons,jackrabbit-spi-commons,jackrabbit-spi,lucene-core,derby,concurrent,jackrabbit-text-extractors,pdfbox,jempbox,fontbox,poi,poi-scratchpad,nekohtml,xercesImpl
                            </includeArtifactIds>
                            <excludeTransitive>false</excludeTransitive>
                            <outputDirectory>
                                ${project.build.outputDirectory}
                            </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!--
                By default the JAR plugin will use the MANIFEST.MF file found
                in the src/main/resources/META-INF folder, which is copied
                as a resource.
                
                To use a manifest file, which is generated with the Apache
                Felix Maven Bundle plugin enable the bundle profile (see below)
                as in
                
                    $ mvn -P bundle clean install
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <manifestFile>
                            ${project.build.outputDirectory}/META-INF/MANIFEST.MF
                        </manifestFile>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <profiles>
        <!-- 
            The bundle profile may be used to update the manifest entries of
            the above default profile. If running the build with the build
            profile, you may use the generated manifest to update the
            src/main/resources/META-INF/MANIFEST.MF file for it to be used
            in future builds excluding the bundle profile.
        -->
        <profile>
            <id>bundle</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>maven-bundle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-manifest</id>
                                <goals>
                                    <goal>manifest</goal>
                                </goals>
                                <configuration>
                                    <instructions>
                                        <Note>Built by bundle profile</Note>
                                        <Bundle-Category>
                                            sling,jcr,jackrabbit
                                        </Bundle-Category>
                                        <Bundle-Activator>
                                            org.apache.sling.jcr.jackrabbit.server.impl.Activator
                                        </Bundle-Activator>
                                        <Export-Package>
                                        	org.apache.sling.jcr.jackrabbit.server.security.*;version=2.0.4-incubator,
                                            org.apache.jackrabbit.core.security.principal;version=1.6.0
                                        </Export-Package>
                                        <Private-Package>
                                            org.apache.sling.jcr.jackrabbit.server.impl.*
                                        </Private-Package>
                                        <Import-Package>
                                            org.apache.sling.*, javax.jcr.*,
                                            javax.naming.*, javax.xml.*,
                                            javax.security.*,
                                            org.apache.commons.collections.*,
                                            org.apache.jackrabbit.api.*,
                                            org.osgi.*,
                                            org.slf4j, org.xml.sax, org.xml.sax.helpers
                                        </Import-Package>
                                        <DynamicImport-Package>*</DynamicImport-Package>
                
                                        <!-- Embedd some libraries -->
                                        <Embed-Transitive>true</Embed-Transitive>
                                        <Embed-Dependency>
                                            <!-- core repository implementation -->
                                            jackrabbit-jcr-rmi; jackrabbit-core;
                                            jackrabbit-jcr-commons;
                                            jackrabbit-spi-commons; jackrabbit-spi;
                                            lucene-core; derby; concurrent,
                                            
                                            <!-- jackrabbit text extraction -->
                                            jackrabbit-text-extractors,
                                            pdfbox, jempbox, fontbox,
                                            poi, poi-scratchpad,
                                            nekohtml, xercesImpl
                                        </Embed-Dependency>
                                        <_removeheaders>
                                            Embed-Dependency,Private-Package,Include-Resource
                                        </_removeheaders>
                                    </instructions>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <excludePackageNames>
                        org.apache.sling.jcr.jackrabbit
                    </excludePackageNames>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <dependencies>
        <dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.jcr.api</artifactId>
            <version>2.0.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.jcr.base</artifactId>
            <version>2.0.6</version>
            <scope>compile</scope>
        </dependency>
        
        <!-- The core repository implementation -->
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>jackrabbit-api</artifactId>
            <version>1.6.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>jackrabbit-core</artifactId>
            <version>1.6.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>jackrabbit-jcr-rmi</artifactId>
            <version>1.5.0</version>
            <scope>compile</scope>
        </dependency>

        <!-- Text Extractor support -->
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>jackrabbit-text-extractors</artifactId>
            <version>1.6.0</version>
        </dependency>
        
        <!-- OSGi Libraries -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
        </dependency>
    </dependencies>

</project>
