<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.teleal.cling</groupId>
        <artifactId>cling</artifactId>
        <version>1.0-beta1</version>
    </parent>

    <name>Cling Support</name>
    <artifactId>cling-support</artifactId>
    <packaging>jar</packaging>

    <build>
        <plugins>

            <!-- The JAXB stuff is a nightmare. I hope Larry fires all of these clowns. Here we
                 simply invoke XJC on "mvn generate-sources" lifecycle and the result will be generated into
                 the main Java source folder - which is what you want to get auto-completion etc. on
                 the generated POJOs. Why the hell would I want to generate sources into a place where
                 my IDE can't find it?!?
            -->
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId> <!-- I guess net.java.* was not obscure enough? -->
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.7.3</version>
                <executions>
                    <execution>
                        <id>generate-sources-jaxb-contentdirectory</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <schemaDirectory>
                                src/main/resources/org/teleal/cling/support/contentdirectory/descriptor/
                            </schemaDirectory>
                            <generateDirectory>src/main/java</generateDirectory>
                            <args>
                                <value>-no-header</value>
                            </args>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-sources-jaxb-renderingcontrol</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <schemaDirectory>
                                src/main/resources/org/teleal/cling/support/renderingcontrol/
                            </schemaDirectory>
                            <generateDirectory>src/main/java</generateDirectory>
                            <args>
                                <value>-no-header</value>
                            </args>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-sources-jaxb-avtransport</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <schemaDirectory>
                                src/main/resources/org/teleal/cling/support/avtransport/
                            </schemaDirectory>
                            <generateDirectory>src/main/java</generateDirectory>
                            <args>
                                <value>-no-header</value>
                            </args>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Clean the JAXB generated sources (which are located within the main source) -->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <filesets>
                        <!-- My god, I can't even delete a directory with this shit, only its contents! -->
                        <fileset>
                            <directory>src/main/java/org/teleal/cling/support/</directory>
                            <includes>
                                <include>avtransport/event/**/*/</include>
                                <include>contentdirectory/descriptor/dc/**/*</include>
                                <include>contentdirectory/descriptor/didl/**/*</include>
                                <include>contentdirectory/descriptor/upnp/**/*/</include>
                                <include>renderingcontrol/event/**/*/</include>
                            </includes>
                        </fileset>
                    </filesets>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>

            <!-- Unit tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/AllTests.tng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>

            <!-- Prepare Javadoc for distribution packaging -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.6.1</version>
                <executions>
                    <execution>
                        <id>package-javadoc</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>javadoc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- WTF! http://jira.codehaus.org/browse/MJAVADOC-268 -->
                    <detectOfflineLinks>false</detectOfflineLinks>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <reporting>
        <excludeDefaults>true</excludeDefaults>

        <plugins>

            <!-- We want Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.6.1</version>
                <reportSets>
                    <reportSet>
                        <id>default</id>
                        <configuration>
                            <detectOfflineLinks>false</detectOfflineLinks>
                        </configuration>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <!-- We want cross-referenced source code -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.1</version>
            </plugin>

        </plugins>

    </reporting>

    <dependencies>

        <dependency>
            <groupId>org.teleal.cling</groupId>
            <artifactId>cling-core</artifactId>
            <version>1.0-beta1</version>
        </dependency>

    </dependencies>

</project>