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

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 2013-2014 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
http://glassfish.java.net/public/CDDL+GPL_1_1.html
or packager/legal/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 packager/legal/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>com.sun.xml.bind.mvn</groupId>
        <artifactId>jaxb-osgi</artifactId>
        <version>2.2.10</version>
    </parent>

    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-osgi</artifactId>

    <packaging>jar</packaging>
    <name>JAXB OSGI</name>
    <description>JAXB OSGI bundle</description>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxb-core</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxb-impl</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxb-jxc</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxb1-impl</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <properties>
        <generated.sources.dir>${project.build.directory}/generated-sources</generated.sources.dir>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>src/main/assembly/assembly.xml</descriptor>
                    </descriptors>
                    <finalName>classes</finalName>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                        <configuration>
                            <instructions>
                                <Export-Package>
                                    com.sun.codemodel;version=${jaxb.osgiVersion},
                                    com.sun.codemodel.*;version=${jaxb.osgiVersion},
                                    com.sun.istack;version=${istack.version},
                                    com.sun.istack.*;version=${istack.version},
                                    com.sun.tools.*;version=${jaxb.osgiVersion},
                                    com.sun.xml.bind;version=${jaxb.osgiVersion},
                                    com.sun.xml.bind.*;version=${jaxb.osgiVersion},
                                    com.sun.xml.dtdparser;version=${dtd-parser.version},
                                    com.sun.xml.dtdparser.*;version=${dtd-parser.version},
                                    com.sun.xml.fastinfoset;version=${fastinfoset.version},
                                    com.sun.xml.fastinfoset.*;version=${fastinfoset.version},
                                    com.sun.xml.txw2;version=${jaxb.osgiVersion},
                                    com.sun.xml.txw2.*;version=${jaxb.osgiVersion},
                                    com.sun.xml.xsom;version=${xsom.version},
                                    com.sun.xml.xsom.*;version=${xsom.version},
                                    org.jvnet.fastinfoset;version=${fastinfoset.version},
                                    org.jvnet.fastinfoset.*;version=${fastinfoset.version},
                                    org.jvnet.staxex;version=${stax-ex.version},
                                    org.jvnet.staxex.util;version=${stax-ex.version},
                                    org.kohsuke.rngom.*;version=${jaxb.osgiVersion},
                                    org.relaxng.datatype;version=${relaxngDatatype.version},
                                    org.relaxng.datatype.*;version=${relaxngDatatype.version}
                                </Export-Package>
                                <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
                                <Import-Package>
                                    javax.xml.bind;version=${jaxb-api.version},
                                    javax.xml.bind.annotation;version=${jaxb-api.version},
                                    javax.xml.bind.annotation.adapters;version=${jaxb-api.version},
                                    javax.xml.bind.attachment;version=${jaxb-api.version},
                                    javax.xml.bind.helpers;version=${jaxb-api.version},
                                    javax.activation,
                                    javax.annotation.processing,
                                    javax.imageio,
                                    javax.imageio.stream,
                                    javax.lang.model,
                                    javax.lang.model.element,
                                    javax.lang.model.type,
                                    javax.lang.model.util,
                                    javax.swing,
                                    javax.swing.border,
                                    javax.swing.tree,
                                    javax.tools,
                                    javax.xml.datatype,
                                    javax.xml.namespace,
                                    javax.xml.parsers,
                                    javax.xml.stream,
                                    javax.xml.stream.events,
                                    javax.xml.stream.util,
                                    javax.xml.transform,
                                    javax.xml.transform.dom,
                                    javax.xml.transform.sax,
                                    javax.xml.transform.stream,
                                    javax.xml.validation,
                                    javax.xml.xpath,
                                    org.w3c.dom,
                                    org.w3c.dom.ls,
                                    org.xml.sax,
                                    org.xml.sax.ext,
                                    org.xml.sax.helpers,
                                    com.sun.org.apache.xml.internal.resolver;resolution:=optional,
                                    com.sun.org.apache.xml.internal.resolver.tools;resolution:=optional,
                                    com.sun.source.tree,
                                    com.sun.source.util,
                                    org.apache.tools.ant;resolution:=optional,
                                    org.apache.tools.ant.taskdefs;resolution:=optional,
                                    org.apache.tools.ant.taskdefs.compilers;resolution:=optional,
                                    org.apache.tools.ant.types;resolution:=optional,
                                    com.sun.msv.grammar;version=${msv.version};resolution:=optional,
                                    com.sun.msv.grammar.trex;version=${msv.version};resolution:=optional,
                                    com.sun.msv.grammar.util;version=${msv.version};resolution:=optional,
                                    com.sun.msv.util;version=${msv.version};resolution:=optional,
                                    com.sun.msv.verifier;version=${msv.version};resolution:=optional,
                                    com.sun.msv.verifier.regexp;version=${msv.version};resolution:=optional,
                                    org.iso_relax.verifier.impl;version=${isorelax.version};resolution:=optional,
                                    javax.xml.soap;resolution:=optional
                                </Import-Package>
                            </instructions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <useDefaultManifestFile>true</useDefaultManifestFile>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <configuration>
                    <skip>${findbugs.skip}</skip>
                    <threshold>${findbugs.threshold}</threshold>
                    <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
                    <!-- Use all excludes used for rebundled artifacts --> 
                    <excludeFilterFile>
                        exclude-common.xml,
                        ${project.basedir}/exclude.xml,
                        ${project.basedir}/../../../runtime/impl/exclude-runtime.xml,
                        ${project.basedir}/../../../jxc/exclude-jxc.xml
                    </excludeFilterFile>
                    <fork>true</fork>
                    <jvmArgs>-Xms64m -Xmx256m</jvmArgs>
                </configuration>
            </plugin>

            <!--    Can be used to build everything from sources
                  <plugin>
                      <groupId>org.glassfish.build</groupId>
                      <artifactId>glassfishbuild-maven-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>unpack-sources</id>
                              <phase>process-resources</phase>
                              <goals>
                                  <goal>unpack-sources</goal>
                              </goals>
                              <configuration>
                                  <attachSources>true</attachSources>
                                  <excludes>*.java</excludes>
                                  <excludeTransitive>true</excludeTransitive>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
            -->

            <plugin> <!-- want to unpack sources from individual modules -->
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <skip>${skipSources}</skip>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind</groupId>
                                    <artifactId>jaxb-core</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind</groupId>
                                    <artifactId>jaxb-xjc</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind</groupId>
                                    <artifactId>jaxb-impl</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind</groupId>
                                    <artifactId>jaxb-jxc</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind</groupId>
                                    <artifactId>jaxb1-impl</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.jvnet.staxex</groupId>
                                    <artifactId>stax-ex</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.fastinfoset</groupId>
                                    <artifactId>FastInfoset</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>
        </plugins>
    </build>
</project>
