<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<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">

    <parent>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>project</artifactId>
        <version>2.3.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-eclipselink-plugin</artifactId>
    <version>2.3.2</version>

    <name>JAX-WS RI Eclipselink Plugin</name>
    <description>Pluggable databinding module employing Eclipselink JAXB (MOXy)</description>

    <properties>
        <findbugs.exclude>${project.basedir}/exclude.xml</findbugs.exclude>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.mail</groupId>
            <artifactId>jakarta.mail-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.moxy</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jvnet.staxex</groupId>
            <artifactId>stax-ex</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>jakarta.activation</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>jakarta.mail</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-property</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <rules>
                                <requireProperty>
                                    <property>jaxws.osgiVersion</property>
                                    <message>Property jaxws.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>mail.majorVersion</property>
                                    <message>Property mail.majorVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>jaxb-api.osgiVersion</property>
                                    <message>Property jaxb-api.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>stax-ex.version</property>
                                    <message>Property stax-ex.version not imported or set!</message>
                                </requireProperty>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <classpathDependencyExcludes>jakarta.activation:jakarta.activation-api,jakarta.mail:jakarta.mail-api</classpathDependencyExcludes>
                    <!-- to make sure that plugin's classes are at the end of the cp
                    otherwise testHelloEchoNoMode(com.sun.xml.ws.jaxbri.JAXBRIBasicTest) will fail
                    as it requires specific order of jars on the cp -->
                    <classesDirectory>/non/existing/directory</classesDirectory>
                    <additionalClasspathElements>
                        <additionalClasspathElement>${project.build.outputDirectory}</additionalClasspathElement>
                    </additionalClasspathElements>
                    <forkCount>0</forkCount>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>osgi-bundle</id>
            <activation>
                <property>
                    <name>!cobertura-build</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>maven-bundle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>osgi-bundle</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>manifest</goal>
                                </goals>
                                <configuration>
                                    <instructions>
                                        <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
                                        <Export-Package>
                                            com.sun.xml.ws.db.toplink;version=${jaxws.osgiVersion}
                                        </Export-Package>
                                        <Import-Package>
                                            com.sun.xml.ws.util.xml;version=${jaxws.osgiVersion},
                                            com.sun.xml.ws.model;version=${jaxws.osgiVersion},
                                            com.sun.xml.ws.api.model;version=${jaxws.osgiVersion},
                                            com.sun.xml.ws.spi.db;version=${jaxws.osgiVersion},
                                            javax.activation,
                                            javax.mail.internet;version=${mail.majorVersion}.${mail.minorVersion},
                                            javax.xml.bind;version=${jaxb-api.osgiVersion},
                                            javax.xml.bind.annotation;version=${jaxb-api.osgiVersion},
                                            javax.xml.bind.attachment;version=${jaxb-api.osgiVersion},
                                            javax.xml.namespace,
                                            javax.xml.parsers,
                                            javax.xml.stream,
                                            javax.xml.transform,
                                            javax.xml.transform.dom,
                                            javax.xml.transform.sax,
                                            javax.xml.transform.stream,
                                            javax.xml.ws;version=${jaxws-api.osgiVersion},
                                            org.eclipse.persistence;version=2.4.0,
                                            org.eclipse.persistence.internal.oxm.record;version=2.4.0,
                                            org.eclipse.persistence.jaxb;version=2.4.0,
                                            org.eclipse.persistence.oxm.record;version=2.4.0,
                                            org.jvnet.staxex;version=${stax-ex.version},
                                            org.w3c.dom,
                                            org.xml.sax
                                        </Import-Package>
                                    </instructions>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <configuration>
                            <archive>
                                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                            </archive>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
