<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.daisy.pipeline</groupId>
    <artifactId>framework-parent</artifactId>
    <version>1.15.7</version>
    <relativePath>../parent</relativePath>
  </parent>

  <groupId>org.daisy.pipeline</groupId>
  <artifactId>persistence-derby</artifactId>
  <version>2.0.12</version>
  <packaging>bundle</packaging>

  <name>DAISY Pipeline 2 :: Apache Derby Connector</name>

  <dependencies>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>common-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>framework-persistence</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.persistence</groupId>
      <artifactId>javax.persistence</artifactId>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>ds-to-spi-runtime</artifactId>
      <scope>provided</scope>
    </dependency>
    <!--
        runtime dependencies
    -->
    <!--
        only for OSGi-less
    -->
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <scope>runtime</scope>
    </dependency>
    <!--
        are some of these only needed for OSGi?
    -->
    <dependency>
      <groupId>org.eclipse</groupId>
      <artifactId>org.eclipse.gemini.jpa</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.gemini</groupId>
      <artifactId>org.apache.derby</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.gemini</groupId>
      <artifactId>org.eclipse.gemini.dbaccess.derby</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.gemini</groupId>
      <artifactId>org.eclipse.gemini.dbaccess.util</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.persistence</groupId>
      <artifactId>org.eclipse.persistence.asm</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.persistence</groupId>
      <artifactId>org.eclipse.persistence.antlr</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.persistence</groupId>
      <artifactId>org.eclipse.persistence.core</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.persistence</groupId>
      <artifactId>org.eclipse.persistence.jpa</artifactId>
      <scope>runtime</scope>
    </dependency>
    <!--
        test dependencies
    -->
    <dependency>
      <groupId>org.daisy.pipeline.build</groupId>
      <artifactId>modules-test-helper</artifactId>
      <scope>test</scope>
      <exclusions>
        <!--
            FIXME: This is needed to make the enforcer rule pass, even though transitive
            dependencies of a test dependency can not be compile dependencies! Is this a Maven bug?
        -->
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Require-Bundle>org.apache.derby;bundle-version="10.5"</Require-Bundle>
            <_dsannotations>
              org.daisy.pipeline.persistence.impl.derby.DerbyEntityManagerFactory
            </_dsannotations>
            <Import-Package>!org.daisy.common.spi,*</Import-Package>
          </instructions>
        </configuration>
        <executions>
          <execution>
            <id>bundle-before-test</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>bundle</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.daisy.pipeline.build</groupId>
        <artifactId>modules-build-helper</artifactId>
        <executions>
          <execution>
            <id>process-test-catalog</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>process-test-catalog</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <reuseForks>false</reuseForks>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.daisy.pipeline.build</groupId>
        <artifactId>ds-to-spi-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-spi-classes</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate-spi-classes</goal>
            </goals>
            <configuration>
              <includes>
                org.daisy.pipeline.persistence.impl.derby.DerbyEntityManagerFactory
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>generate-spi-test-classes</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>generate-spi-test-classes</goal>
            </goals>
            <configuration>
              <includes>
                MockXProcEngine,
                org.daisy.pipeline.script.impl.XProcScript_my_script
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>