<?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-bundles</artifactId>
        <version>2.2.11</version>
    </parent>

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

    <packaging>jar</packaging>
    <name>Old JAXB XJC</name>
    <description>
        Old JAXB Binding Compiler. Contains source code needed for binding customization files into java sources.
        In other words: the *tool* to generate java classes for the given xml representation.
        <!--todo: finish me-->
    </description>

    <dependencies>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>codemodel</artifactId>
            <optional>true</optional>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>4.2.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.hk2.external</groupId>
            <artifactId>javax.inject</artifactId>
            <version>2.1.64</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-container-paxrunner</artifactId>
            <version>${exam.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.ops4j.base</groupId>
                    <artifactId>ops4j-base-store</artifactId>
                </exclusion>
            </exclusions>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.base</groupId>
            <artifactId>ops4j-base-store</artifactId>
            <version>1.3.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.runner</groupId>
            <artifactId>pax-runner-no-jcl</artifactId>
            <version>1.7.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-junit4</artifactId>
            <version>${exam.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-link-mvn</artifactId>
            <version>${exam.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>0.9.29</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>0.9.29</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <generated.sources.dir>${project.build.directory}/generated-sources</generated.sources.dir>
        <generated.classes.dir>${project.build.directory}/classes</generated.classes.dir>
        <exam.version>3.0.0.M3</exam.version>
    </properties>

    <build>
        <plugins>
            <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>org.glassfish.jaxb</groupId>
                                    <artifactId>jaxb-xjc</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xsom</groupId>
                                    <artifactId>xsom</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>relaxngDatatype</groupId>
                                    <artifactId>relaxngDatatype</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.glassfish.jaxb</groupId>
                                    <artifactId>codemodel</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind.external</groupId>
                                    <artifactId>rngom</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.dtd-parser</groupId>
                                    <artifactId>dtd-parser</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.istack</groupId>
                                    <artifactId>istack-commons-tools</artifactId>
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-classes</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.glassfish.jaxb</groupId>
                                    <artifactId>jaxb-xjc</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xsom</groupId>
                                    <artifactId>xsom</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>relaxngDatatype</groupId>
                                    <artifactId>relaxngDatatype</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.glassfish.jaxb</groupId>
                                    <artifactId>codemodel</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.bind.external</groupId>
                                    <artifactId>rngom</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.xml.dtd-parser</groupId>
                                    <artifactId>dtd-parser</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.istack</groupId>
                                    <artifactId>istack-commons-tools</artifactId>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.classes.dir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </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>*</Export-Package>
                                <Import-Package>*, com.sun.org.apache.xml.internal.resolver;resolution:=optional,com.sun.org.apache.xml.internal.resolver.tools;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>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${generated.sources.dir}</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-manifest</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/target/classes/META-INF</directory>
                                    <targetPath>META-INF</targetPath>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>org.glassfish.jaxb:jaxb-xjc</include>
                                    <include>org.glassfish.jaxb:codemodel</include>
                                    <include>com.sun.istack:istack-commons-tools</include>
                                    <include>com.sun.xml.dtd-parser:dtd-parser</include>
                                    <include>com.sun.xsom:xsom</include>
                                    <include>com.sun.xml.bind.external:rngom</include>
                                    <include>relaxngDatatype:relaxngDatatype</include>
                                </includes>

                                <excludes>
                                    <exclude>org.glassfish.jaxb:jaxb-core</exclude>
                                    <exclude>javax.xml.bind:jaxb-api</exclude>
                                    <exclude>org.glassfish.jaxb:txw2</exclude>
                                    <exclude>javax.xml.stream:stax-api</exclude>
                                    <exclude>com.sun.istack:istack-commons-runtime</exclude>
                                    <exclude>org.apache.ant:ant</exclude>
                                    <exclude>org.apache.ant:ant-launcher</exclude>
                                    <exclude>com.sun.org.apache.xml.internal:resolver</exclude>
                                </excludes>

                            </artifactSet>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.sun.tools.xjc.XJCFacade</mainClass>
                                    <manifestEntries>
                                        <Class-Path>jaxb-core.jar jaxb-impl.jar</Class-Path>
                                        <Major-Version>${jaxb.majorVersion}.${jaxb.minorVersion}.${jaxb.incrementalVersion}</Major-Version>
                                        <Specification-Version>${jaxb-api.majorVersion}.${jaxb-api.minorVersion}</Specification-Version>
                                        <Git-Revision>${buildNumber}</Git-Revision>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.13</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>integration-test</phase>
                        <configuration>
                            <skip>false</skip>
                            <systemProperties>
                                <jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
                                <osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
                            </systemProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
