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

    Copyright (c) 1997, 2020 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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.glassfish.metro</groupId>
        <artifactId>bundles</artifactId>
        <version>2.4.4</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>webservices-osgi</artifactId>
    <packaging>bundle</packaging>
    <name>Metro Web Services Runtime OSGi Bundle</name>
    <description>Metro Web Services Runtime OSGi Bundle</description>

    <build>
        <plugins>
            <plugin> <!-- want to unpack sources from individual modules -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-meta-inf-entries</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeTransitive>true</excludeTransitive>
                            <includes>META-INF/services/*, META-INF/metro-default.xml, META-INF/jaxrpc/*</includes>
                            <excludes>META-INF/services/com.sun.xml.ws.spi.db.*, META-INF/services/com.sun.tools.*, META-INF/services/javax.xml.bind.*, META-INF/services/javax.xml.stream.*, META-INF/services/javax.mail.*, META-INF/services/org.*</excludes>
                            <outputDirectory>${project.build.directory}/generated-sources/resources</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>jakarta.xml.registry</groupId>
                                    <artifactId>jakarta.xml.registry-api</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>webservices-rt</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>webservices-extra</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>webservices-tools</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-meta-inf-entries</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.build.directory}/generated-sources/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${generated.sources.dir}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-property</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <rules>
                                <requireProperty>
                                    <property>jaxb.osgiVersion</property>
                                    <message>Property jaxb.osgiVersion 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>saaj-api.osgiVersion</property>
                                    <message>Property saaj-api.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>saaj-impl.osgiVersion</property>
                                    <message>Property saaj-impl.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>jaxrpc-impl.osgiVersion</property>
                                    <message>Property jaxrpc-impl.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>jaxws.osgiVersion</property>
                                    <message>Property jaxws.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>jaxws-api.osgiVersion</property>
                                    <message>Property jaxws-api.osgiVersion not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>metro.osgiVersion</property>
                                    <message>Property metro.osgiVersion not imported or set!</message>
                                </requireProperty>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <excludeDependencies>jaxws-eclipselink-plugin,sdo-eclipselink-plugin</excludeDependencies>
                    <instructions>
                        <Export-Package>
                            com.oracle.webservices.*;version=${jaxws.osgiVersion},
                            com.oracle.xmlns.webservices.jaxws_databinding;version=${jaxws.osgiVersion},
                            com.sun.istack.ws.*;version=${jaxb.osgiVersion},
                            com.sun.istack.localization;version=${jaxb.osgiVersion};uses:="com.sun.xml.ws.resources,com.sun.tools.ws.resources",
                            com.sun.tools.ws.*;version=${jaxws.osgiVersion},
                            com.sun.wsit.security.*;version=${metro.osgiVersion},
                            com.sun.xml.messaging.saaj.*;version=${saaj-impl.osgiVersion},
                            com.sun.xml.registry.*;version=1.0,
                            com.sun.xml.rpc.plugins;version=${metro.osgiVersion},
                            com.sun.xml.rpc.security;version=${metro.osgiVersion},
                            com.sun.xml.rpc.*;version=${jaxrpc-impl.osgiVersion},
                            com.sun.xml.security.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.api.config.management;version=${jaxws.osgiVersion},
                            com.sun.xml.ws.api.config.management.policy;version=${jaxws.osgiVersion},
                            com.sun.xml.ws.api.config.management.jmx;version=${metro.osgiVersion},
                            com.sun.xml.ws.api.security.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.api.transport.tcp.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.api.tx.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.assembler.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.commons.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.config.management.policy.*;version=${jaxws.osgiVersion},
                            com.sun.xml.ws.config.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.metro.api.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.policy.config.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.policy.impl.bindings.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.policy.jaxws.*;version=${jaxws.osgiVersion},
                            com.sun.xml.ws.policy.jcaps.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.policy.localization.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.policy.parser.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.runtime.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.rx.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.security.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.transport.tcp.*;version=${metro.osgiVersion},
                            com.sun.xml.ws.*;version=${jaxws.osgiVersion},
                            com.sun.xml.wss.*;version=${metro.osgiVersion},
                            org.jvnet.ws.databinding.*;version=${jaxws.osgiVersion},
                            org.jvnet.ws.message.*;version=${jaxws.osgiVersion},
                            org.jvnet.ws.*;version=${jaxws.osgiVersion},
                            org.apache.jcp.xml.dsig.*;version=${santuario.version},
                            org.apache.xml.security;version=${santuario.version},
                            org.apache.xml.security.*;version=${santuario.version}
                        </Export-Package>
                        <Import-Package>
                            javax.activation;version=!,
                            javax.xml.crypto;version=!,
                            javax.xml.crypto.dom;version=!,
                            javax.xml.crypto.dsig;version=!,
                            javax.xml.crypto.dsig.dom;version=!,
                            javax.xml.crypto.dsig.keyinfo;version=!,
                            javax.xml.crypto.dsig.spec;version=!,
                            com.ibm.security.util;resolution:=optional,
                            com.ibm.security.x509;resolution:=optional,
                            com.sun.istack.*;version=${jaxb.osgiVersion},
                            com.sun.security.auth.callback;resolution:=optional,
                            sun.security.action;resolution:=optional,
                            sun.security.jgss;resolution:=optional,
                            sun.security.jgss.spi;resolution:=optional,
                            sun.security.krb5;resolution:=optional,
                            sun.security.krb5.internal.crypto;resolution:=optional,
                            sun.security.util;resolution:=optional,
                            sun.security.x509;resolution:=optional,
                            com.sun.security.jgss;resolution:=optional,
                            com.sun.enterprise.web.*;resolution:=optional,
                            org.glassfish.webservice;resolution:=optional,
                            org.glassfish.webservice.monitoring;resolution:=optional,
                            com.sun.mail.util;resolution:=optional,
                            com.sun.org.apache.xalan.internal.*;resolution:=optional,
                            com.sun.org.apache.xml.internal.*;resolution:=optional,
                            com.sun.org.apache.xerces.internal.*;resolution:=optional,
                            com.sun.xml.bind.api.impl;resolution:=optional,
                            com.sun.xml.rpc.*;resolution:=optional,
                            javax.ejb;resolution:=optional;version=3.0,
                            javax.jws;version=2.0,
                            javax.jws.soap;version=2.0,
                            javax.xml.soap.*;version=${saaj-api.osgiVersion},
                            javax.xml.ws.*;version=${jaxws-api.osgiVersion},
                            javax.xml.bind.*;version=${jaxb-api.osgiVersion},
                            org.apache.coyote;resolution:=optional,
                            org.apache.tomcat.util.buf;resolution:=optional,
                            org.jvnet.mimepull;resolution:=optional,
                            org.relaxng.datatype;resolution:=optional,
                            org.relaxng.datatype.helpers;resolution:=optional,
                            org.apache.xml.dtm;resolution:=optional,
                            org.apache.xml.utils;resolution:=optional,
                            org.apache.xpath;resolution:=optional,
                            org.apache.xpath.compiler;resolution:=optional,
                            org.apache.xpath.functions;resolution:=optional,
                            org.apache.xpath.objects;resolution:=optional,
                            org.w3c.dom;resolution:=optional,
                            org.xml.sax;resolution:=optional,
                            org.apache.log;resolution:=optional,
                            org.apache.log4j;resolution:=optional,
                            org.apache.avalon.framework.logger;resolution:=optional,
                            jdk.internal.misc;resolution:=optional,
                            com.sun.enterprise.webservice;resolution:=optional,
                            *
                        </Import-Package>
                        <Private-Package>
                            com.sun.xml.stream.*,
                            com.sun.xml.xwss.*;version=${metro.osgiVersion},
                            com.sun.xml.util.*;version=${metro.osgiVersion};include="XMLCipherAdapter",
                            javanet.staxutils.*,
                            org.apache.commons.logging,
                            org.apache.commons.logging.impl,
                        </Private-Package>
                        <DynamicImport-Package>
                            org.glassfish.flashlight.provider,
                            org.glassfish.hk2.osgiresourcelocator
                        </DynamicImport-Package>
                        <probe-provider-class-names>com.sun.xml.ws.transport.http.servlet.JAXWSRIDeploymentProbeProvider,com.sun.xml.ws.transport.http.servlet.JAXWSRIServletProbeProvider</probe-provider-class-names>
                    </instructions>
                    <unpackBundle>true</unpackBundle>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <excludePackageNames>*com.sun.xml.ws*:com.sun.tools.*:com.sun.enterprise.*:java.*:isorelax.*:src.*:*javanet*:*test*:*ctc*:*glassfish*:*com.sun.istack.tools*:javax.xml.crypto.*:org.apache.xml.security.*:org.apache.jcp.xml.dsig.internal.*:org.apache.commons.*:com.sun.grizzly.*</excludePackageNames>
                    <additionalDependencies>
                        <dependency>
                            <groupId>org.glassfish.hk2</groupId>
                            <artifactId>hk2-api</artifactId>
                            <version>2.5.0</version>
                        </dependency>
                        <dependency>
                            <groupId>org.glassfish.grizzly</groupId>
                            <artifactId>grizzly-framework</artifactId>
                            <version>2.4.4</version>
                        </dependency>
                        <dependency>
                            <groupId>org.glassfish.grizzly</groupId>
                            <artifactId>grizzly-portunif</artifactId>
                            <version>2.4.4</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.tomcat</groupId>
                            <artifactId>tomcat-coyote</artifactId>
                            <version>9.0.8</version>
                        </dependency>
                        <dependency>
                            <groupId>com.sun.org.apache.xml.internal</groupId>
                            <artifactId>resolver</artifactId>
                            <version>${resolver.version}</version>
                        </dependency>
                    </additionalDependencies>
                    <sourceFileExcludes>
                        <sourceFileExclude>META-INF/**</sourceFileExclude>
                        <sourceFileExclude>org/glassfish/**</sourceFileExclude>
                        <sourceFileExclude>org/jvnet/hk2/**</sourceFileExclude>
                    </sourceFileExcludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>jakarta.xml.registry</groupId>
            <artifactId>jakarta.xml.registry-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-rt</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-extra</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-tools</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.soap</groupId>
            <artifactId>jakarta.xml.soap-api</artifactId>
        </dependency>
         <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.resource</groupId>
            <artifactId>jakarta.resource-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--
            Declaring OSGi dependecies:
            GF application client module somehow creates it's HK2 classpath using
            (also) the declared webservices-osgi maven module dependencies. Although
            this project does not really need these dependencies to build itself,
            not declaring these dependencies in webservices-osgi causes that GF
            appclient module cannot load some classes (e.g. mimepull) which makes
            some CTS smoke tests to fail
        -->

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-api-osgi</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.rpc</groupId>
            <artifactId>jakarta.xml.rpc-api</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-extra-jdk-packages</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.woodstox</groupId>
            <artifactId>woodstox-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jvnet.mimepull</groupId>
            <artifactId>mimepull</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-eclipselink-plugin</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>sdo-eclipselink-plugin</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
    </dependencies>
    <properties>
        <generated.sources.dir>${project.build.directory}/generated-sources/src</generated.sources.dir>
        <jacoco.skip>true</jacoco.skip>
        <mf.dir>${project.build.outputDirectory}</mf.dir>
    </properties>
</project>
