<?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.jackrabbit</groupId>
    <artifactId>oak-parent</artifactId>
    <version>1.90.0</version>
    <relativePath>../oak-parent/pom.xml</relativePath>
  </parent>

  <artifactId>oak-core</artifactId>
  <name>Oak Core</name>
  <packaging>bundle</packaging>

  <properties>
    <!-- enable execution of jacoco and set minimal line coverage -->
    <skip.coverage>false</skip.coverage>
      <minimum.line.coverage>0.77</minimum.line.coverage>
      <minimum.branch.coverage>0.70</minimum.branch.coverage>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Import-Package>
              com.codahale.metrics*;version="[3.1, 4)";resolution:=optional,
              *
            </Import-Package>
            <Export-Package>
              org.apache.jackrabbit.oak,
              org.apache.jackrabbit.oak.namepath.impl,
              org.apache.jackrabbit.oak.plugins.commit,
              org.apache.jackrabbit.oak.plugins.identifier,
              org.apache.jackrabbit.oak.plugins.index,
              org.apache.jackrabbit.oak.plugins.index.aggregate,
              org.apache.jackrabbit.oak.plugins.index.cursor,
              org.apache.jackrabbit.oak.plugins.index.fulltext,
              org.apache.jackrabbit.oak.plugins.index.importer,
              org.apache.jackrabbit.oak.plugins.index.property,
              org.apache.jackrabbit.oak.plugins.index.property.strategy,
              org.apache.jackrabbit.oak.plugins.index.reference,
              org.apache.jackrabbit.oak.plugins.lock,
              org.apache.jackrabbit.oak.plugins.migration,
              org.apache.jackrabbit.oak.plugins.migration.report,
              org.apache.jackrabbit.oak.plugins.name,
              org.apache.jackrabbit.oak.plugins.nodetype,
              org.apache.jackrabbit.oak.plugins.nodetype.write,
              org.apache.jackrabbit.oak.plugins.observation,
              org.apache.jackrabbit.oak.plugins.observation.filter,
              org.apache.jackrabbit.oak.plugins.tree.factories,
              org.apache.jackrabbit.oak.plugins.version,
                org.apache.jackrabbit.oak.plugins.metric.util
            </Export-Package>
            <Jaas-ModuleClass>
              org.apache.jackrabbit.oak.spi.security.authentication.GuestLoginModule,
              org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl,
              org.apache.jackrabbit.oak.security.authentication.token.TokenLoginModule
            </Jaas-ModuleClass>
            <DynamicImport-Package>
              org.apache.felix.jaas.boot
            </DynamicImport-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <java.util.logging.config.file>
              src/test/resources/logging.properties
            </java.util.logging.config.file>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/test.json</exclude>
          </excludes>
        </configuration>
      </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>pre-unit-test</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                    <configuration>
                        <skip>${skip.coverage}</skip>
                        <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                        <propertyName>test.opts.coverage</propertyName>
                    </configuration>
                </execution>
                <execution>
                    <id>post-unit-test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <skip>${skip.coverage}</skip>
                        <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                    </configuration>
                </execution>
                <execution>
                    <id>default-check</id>
                    <goals>
                        <goal>check</goal>
                    </goals>
                    <configuration>
                        <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                        <rules>
                            <rule>
                                <element>BUNDLE</element>
                                <limits>
                                    <limit>
                                        <counter>LINE</counter>
                                        <value>COVEREDRATIO</value>
                                        <minimum>${minimum.line.coverage}</minimum>
                                    </limit>
                                    <limit>
                                        <counter>BRANCH</counter>
                                        <value>COVEREDRATIO</value>
                                        <minimum>${minimum.branch.coverage}</minimum>
                                    </limit>
                                </limits>
                            </rule>
                            <rule>
                                <element>PACKAGE</element>
                                <includes>
                                    <include>org.apache.jackrabbit.oak.security.authentication</include>
                                    <include>org.apache.jackrabbit.oak.security.authentication.monitor</include>
                                    <include>org.apache.jackrabbit.oak.security.authentication.user</include>
                                    <include>org.apache.jackrabbit.oak.security.authorization</include>
                                    <include>org.apache.jackrabbit.oak.security.authorization.monitor</include>
                                    <include>org.apache.jackrabbit.oak.security.internal</include>
                                    <include>org.apache.jackrabbit.oak.security.principal</include>
                                    <include>org.apache.jackrabbit.oak.security.privilege</include>
                                    <include>org.apache.jackrabbit.oak.security.user.autosave</include>
                                    <include>org.apache.jackrabbit.oak.security.user.monitor</include>
                                    <include>org.apache.jackrabbit.oak.security.user.query</include>
                                    <include>org.apache.jackrabbit.oak.security.user.whiteboard</include>
                                </includes>
                                <excludes>
                                    <exclude>*Test</exclude>
                                </excludes>
                                <limits>
                                    <limit>
                                        <counter>BRANCH</counter>
                                        <value>COVEREDRATIO</value>
                                        <minimum>1.0</minimum>
                                    </limit>
                                </limits>
                            </rule>
                            <rule>
                                <element>PACKAGE</element>
                                <includes>
                                    <include>org.apache.jackrabbit.oak.security.authentication.token</include>
                                    <include>org.apache.jackrabbit.oak.security.authorization.accesscontrol</include>
                                    <include>org.apache.jackrabbit.oak.security.authorization.composite</include>
                                    <include>org.apache.jackrabbit.oak.security.authorization.permission</include>
                                    <include>org.apache.jackrabbit.oak.security.authorization.restriction</include>
                                    <include>org.apache.jackrabbit.oak.security.user</include>
                                </includes>
                                <excludes>
                                    <exclude>*Test</exclude>
                                </excludes>
                                <limits>
                                    <limit>
                                        <counter>BRANCH</counter>
                                        <value>COVEREDRATIO</value>
                                        <minimum>0.99</minimum>
                                    </limit>
                                </limits>
                            </rule>
                        </rules>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- Optional OSGi dependencies, used only when running within OSGi -->
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.annotation.versioning</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.component</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.component.annotations</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.metatype.annotations</artifactId>
      <scope>provided</scope>
   </dependency>

    <!-- Dependencies to other Oak components -->
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-jackrabbit-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-core-spi</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-query-spi</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-security-spi</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-commons</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-commons</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-blob-plugins</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-store-spi</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- General utility libraries -->
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-core</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- JCR and Jackrabbit dependencies -->
    <dependency>
      <groupId>javax.jcr</groupId>
      <artifactId>jcr</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-commons</artifactId>
      <version>${jackrabbit.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-shaded-guava</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.inventory</artifactId>
      <version>1.0.4</version>
      <optional>true</optional>
    </dependency>

    <!-- Nullability annotations -->
    <dependency>
      <groupId>org.jetbrains</groupId>
      <artifactId>annotations</artifactId>
    </dependency>

    <!-- Test Dependencies -->
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easymock</groupId>
      <artifactId>easymock</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-core-spi</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-blob-plugins</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.sling</groupId>
      <artifactId>org.apache.sling.testing.osgi-mock.junit4</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.log</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.event</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.cm</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
