<?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">
    <parent>
        <groupId>com.sonsure</groupId>
        <artifactId>sonsure-replay-parent</artifactId>
        <version>1.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>poi</artifactId>
    <version>5.2.0</version>
    <packaging>bundle</packaging>

    <properties>
        <poi.version>5.2.0</poi.version>
        <poi-ooxml.version>5.2.0</poi-ooxml.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <!--两个包必须打在一起，不然osgi环境下不同ClassLoader会加载不到-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi-ooxml.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeArtifactIds>
                                commons-codec,commons-collections4,commons-math3,commons-io,log4j-api,commons-compress
                            </excludeArtifactIds>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <unpackBundle>true</unpackBundle>
                    <instructions>
                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Description>OSGI version of jar ${project.artifactId}</Bundle-Description>
                        <Export-Package>*,META-INF.services.*</Export-Package>
                        <Include-Resource>
                            ${project.build.directory}/classes/font_metrics.properties
                        </Include-Resource>
                        <Import-Package>
                            !javax.*
                            !sun.*,
                            !com.sun.*,
                            !jdk.*,
                            !com.intellij.*,
                            *;resolution:=optional
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>