<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Version: 1.0
  ~
  ~ The contents of this file are subject to the OpenVPMS License Version
  ~ 1.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.openvpms.org/license/
  ~
  ~ Software distributed under the License is distributed on an 'AS IS' basis,
  ~ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  ~ for the specific language governing rights and limitations under the
  ~ License.
  ~
  ~ Copyright 2025 (C) OpenVPMS Ltd. All Rights Reserved.
  -->

<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>
        <artifactId>openvpms-plugins</artifactId>
        <groupId>org.openvpms</groupId>
        <version>2.4.0.12.4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>openvpms-plugin-manager-impl</artifactId>


    <dependencies>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-plugin-manager</artifactId>
            <exclusions>
                <exclusion>
                    <!-- to keep maven-enforcer-plugin quiet -->
                    <!-- these are included by org.apache.felix:org.apache.felix.framework -->
                    <groupId>org.osgi</groupId>
                    <artifactId>org.osgi.core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-framework</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-archetypes</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-version</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.spring-web</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <!--dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr</artifactId>
            <version>${felix.scr.version}</version>
            <scope>provided</scope>
        </dependency-->

        <!-- Atlassian Plugin Framework dependencies -->
        <dependency>
            <!-- needed by rest plugin -->
            <groupId>com.atlassian.http</groupId>
            <artifactId>atlassian-http</artifactId>
        </dependency>
        <dependency>
            <!-- needed by the rest plugin, which uses log4j 1.x -->
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.html</groupId>
            <artifactId>atlassian-html-encoder</artifactId>
            <version>1.4</version>
            <!-- NOTE: must correspond to the version used by com.atlassian.plugins:atlassian-plugins-webresource -->
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</artifactId>
            <version>0.11</version>
            <!-- NOTE: must correspond to the version used by com.atlassian.plugins:atlassian-plugins-webresource -->
        </dependency>
        <dependency>
            <groupId>com.atlassian.velocity.htmlsafe</groupId>
            <artifactId>velocity-htmlsafe</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-main</artifactId>
            <exclusions>
                <exclusion>
                    <!-- replaced by org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j -->
                    <groupId>dom4j</groupId>
                    <artifactId>dom4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-servlet</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.velocity</artifactId>
            <version>1.6.2_6</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <!-- replaced by org.apache.servicemix.bundles:org.apache.servicemix.bundles.oro -->
                    <groupId>oro</groupId>
                    <artifactId>oro</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.oro</artifactId>
            <version>2.0.8_6</version>
            <scope>runtime</scope>
        </dependency>

        <!-- NOTE: if the gemini-blueprint-extender is included in the system classloader -->
        <!-- it will fail to load the META-INF/spring.schemas                             -->
        <!-- Just included below for debugging purposes                                   -->
        <dependency>
            <groupId>org.eclipse.gemini.blueprint</groupId>
            <artifactId>gemini-blueprint-core</artifactId>
            <version>3.0.0.M01</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.gemini.blueprint</groupId>
            <artifactId>gemini-blueprint-extender</artifactId>
            <version>3.0.0.M01</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.dom4j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.jaxen</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <!-- required by velocity. Can be removed if velocity excluded -->
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <!-- required by velocity -->
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>1.6</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-test-plugin</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-test-service</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-archetypes</artifactId>
            <classifier>tests</classifier>
            <scope>test</scope>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${jdbc.groupId}</groupId>
            <artifactId>${jdbc.artifactId}</artifactId>
            <version>${jdbc.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.spring-test</artifactId>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>${project.build.sourceDirectory}/../resources</directory>
                <includes>
                    <include>**</include>
                </includes>
            </resource>
            <resource>
                <directory>${project.build.sourceDirectory}</directory>
                <includes>
                    <include>**/*.xsd</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openvpms</groupId>
                                    <artifactId>openvpms-plugin-framework-bundles</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                    <outputDirectory>${project.build.directory}/test/WEB-INF/plugins</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openvpms</groupId>
                                    <artifactId>openvpms-test-plugin</artifactId>
                                    <version>${project.version}</version>
                                    <outputDirectory>${project.build.directory}/plugin-staging</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.openvpms</groupId>
                                    <artifactId>openvpms-test-servlet-plugin</artifactId>
                                    <version>${project.version}</version>
                                    <outputDirectory>${project.build.directory}/plugin-staging</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkCount>0</forkCount>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <!-- need to exclude dependencies that are loaded by the OSGi container -->
                    <classpathDependencyExcludes>
                        <classpathDependencyExclude>org.eclipse.gemini.blueprint:gemini-blueprint-core
                        </classpathDependencyExclude>
                        <classpathDependencyExclude>org.eclipse.gemini.blueprint:gemini-blueprint-extender
                        </classpathDependencyExclude>
                        <classpathDependencyExclude>org.eclipse.gemini.blueprint:gemini-blueprint-io
                        </classpathDependencyExclude>
                        <classpathDependencyExclude>org.apache.felix:org.apache.felix.scr</classpathDependencyExclude>
                        <classpathDependencyExclude>com.atlassian.plugins.rest:atlassian-rest-module
                        </classpathDependencyExclude>
                        <classpathDependencyExclude>com.atlassian.plugins.rest:atlassian-rest-common
                        </classpathDependencyExclude>
                        <classpathDependencyExclude>org.openvpms:openvpms-test-servlet-plugin
                        </classpathDependencyExclude>
                    </classpathDependencyExcludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>