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

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://oss.oracle.com/licenses/CDDL+GPL-1.1
    or LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<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.2</version>
    </parent>

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

    <build>
        <plugins>
            <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>
                </configuration>
            </plugin>
            <plugin> <!-- want to unpack sources from individual modules -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-meta-inf-entries</id>
                        <phase>process-sources</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/org.*</excludes>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax.xml.registry</groupId>
                                    <artifactId>javax.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>
                        <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>validate</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>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>
                <executions>
                    <execution>
                        <id>osgi-bundle</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                        <configuration>
                            <excludeDependencies>jaxws-eclipselink-plugin,sdo-eclipselink-plugin</excludeDependencies>
                            <instructions>
                                <Export-Package>
                                    com.oracle.webservices.*;version="2.3.1",
                                    com.oracle.xmlns.webservices.jaxws_databinding;version="2.3.1",
                                    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="2.3.1",
                                    com.sun.wsit.security.*;version=${metro.osgiVersion},
                                    com.sun.xml.messaging.saaj.*;version=1.4,
                                    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=1.1.2,
                                    com.sun.xml.security.*;version=${metro.osgiVersion},
                                    com.sun.xml.ws.api.config.management;version="2.3.1",
                                    com.sun.xml.ws.api.config.management.policy;version="2.3.1",
                                    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="2.3.1",
                                    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="2.3.1",
                                    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="2.3.1",
                                    com.sun.xml.wss.*;version=${metro.osgiVersion},
                                    org.jvnet.ws.databinding.*;version="2.3.1",
                                    org.jvnet.ws.message.*;version="2.3.1",
                                    org.jvnet.ws.*;version="2.3.1",
                                    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>
                                    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.appserv.server;resolution:=optional,
                                    com.sun.enterprise.security.*;resolution:=optional,
                                    com.sun.enterprise.transaction.*;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.msv.*;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.*,
                                    com.sun.xml.rpc.*;resolution:=optional,
                                    com.sun.xml.ws.spi.runtime;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-osgi.version},
                                    org.apache.coyote;resolution:=optional,
                                    javax.xml.crypto.*;resolution:=optional;version=0,
                                    org.apache.tomcat.util.buf;resolution:=optional,
                                    org.iso_relax.verifier.impl;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,
                                    *
                                </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>
                            </instructions>
                            <unpackBundle>true</unpackBundle>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${mf.dir}/META-INF/MANIFEST.MF</manifestFile>
                        <manifestEntries>
                            <probe-provider-class-names>com.sun.xml.ws.transport.http.servlet.JAXWSRIDeploymentProbeProvider,com.sun.xml.ws.transport.http.servlet.JAXWSRIServletProbeProvider</probe-provider-class-names>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

   <profiles>
        <profile>
            <id>release-9</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <build>
              <plugins>
                 <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <additionalJOptions>
                            <additionalJOption>--add-modules</additionalJOption>
                            <additionalJOption>java.activation</additionalJOption>
                            <additionalJOption>--add-exports</additionalJOption>
                            <additionalJOption>java.security.jgss/sun.security.krb5=ALL-UNNAMED</additionalJOption>
                            <additionalJOption>--add-exports</additionalJOption>
                            <additionalJOption>java.xml/com.sun.org.apache.xerces.internal.impl.dv.util=ALL-UNNAMED</additionalJOption>
                        </additionalJOptions>
                    </configuration>
                </plugin>
              </plugins>
             </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>javax.xml.registry</groupId>
            <artifactId>javax.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>javax.xml.soap</groupId>
            <artifactId>javax.xml.soap-api</artifactId>
        </dependency>
         <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.main.common</groupId>
            <artifactId>common-util</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>javax.xml.rpc</groupId>
            <artifactId>javax.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>
            <version>1.1.2</version>
        </dependency>
    </dependencies>
    <properties>
        <generated.sources.dir>${project.build.directory}/generated-sources</generated.sources.dir>
        <cobertura.skip>true</cobertura.skip>
        <mf.dir>${project.build.outputDirectory}</mf.dir>
    </properties>
</project>
