<?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/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.n52.sensorweb-server.dao-impl</groupId> 
        <artifactId>dao-impl-parent</artifactId>
        <version>4.0.6</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>dao-impl-webapp</artifactId>
    <packaging>war</packaging>
    <name>Sensor Web Server DAO Impl - Webapp</name>
    <description>RESTful Sensor Web Server Helgoland API as template Web application.</description>

    <properties>

        <postgis.version>2.5.1</postgis.version>
        <javax-jaxb.version>3.0.2</javax-jaxb.version>
        <local.configFile>src/main/resources/application.properties</local.configFile>

        <webapp.workdir>${project.build.directory}/webapp-work</webapp.workdir>

        <docs.context>docs</docs.context>
        <docs.sources.directory>${project.build.directory}/docs-sources</docs.sources.directory>
        <docs.output.directory>${webapp.workdir}/static/${docs.context}</docs.output.directory>

        <finalName>${project.artifactId}</finalName>
        <webappDirectory>${project.build.directory}/${finalName}</webappDirectory>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.n52.sensorweb-server.helgoland</groupId>
            <artifactId>helgoland-rest</artifactId>
            <scope>runtime</scope>
            <exclusions>
              <exclusion>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
              </exclusion>
              <exclusion>
                <groupId>com.mchange</groupId>
                <artifactId>mchange-commons-java</artifactId>
              </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.n52.sensorweb-server.helgoland</groupId>
            <artifactId>helgoland-web-resources</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dao-impl-dao</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dao-impl-repo</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.n52.sensorweb-server.db-model</groupId>
            <artifactId>db-model-entities</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.n52.sensorweb-server.db-model</groupId>
            <artifactId>db-model-types</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.n52.arctic-sea</groupId>
            <artifactId>shetland</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>runtime</scope>
        </dependency>
        
<!--         <dependency> -->
<!--             <groupId>javax.xml.bind</groupId> -->
<!--             <artifactId>jaxb-api</artifactId> -->
<!--             <scope>runtime</scope> -->
<!--         </dependency> -->
<!--         <dependency> -->
<!--             <groupId>com.sun.xml.bind</groupId> -->
<!--             <artifactId>jaxb-impl</artifactId> -->
<!--             <version>2.2.1.1</version> -->
<!--             <scope>runtime</scope> -->
<!--         </dependency> -->
<!--         <dependency> -->
<!--             <groupId>javax.activation</groupId> -->
<!--             <artifactId>activation</artifactId> -->
<!--             <version>1.1.1</version> -->
<!--             <scope>runtime</scope> -->
<!--         </dependency> -->

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
                <groupId>com.mchange</groupId>
                <artifactId>c3p0</artifactId>
                <version>0.9.5.5</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.mchange</groupId>
                        <artifactId>mchange-commons</artifactId>
                    </exclusion>
                </exclusions>
                <scope>runtime</scope>
            </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>net.postgis</groupId>
            <artifactId>postgis-jdbc</artifactId>
            <version>${postgis.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <!-- drop-in replacement for jog4j -->
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.thetransactioncompany</groupId>
            <artifactId>cors-filter</artifactId>
            <version>2.10</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>xmlgraphics-commons</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>janino</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>${finalName}</finalName>
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>

            <resource>
                <directory>src/main/docs</directory>
                <!-- match the unpacked docs folder -->
                <targetPath>${docs.sources.directory}/docs</targetPath>
                <!-- gets filtered after docs generation -->
                <filtering>false</filtering>
            </resource>
        </resources>

        <filters>
            <!-- filters src/main/resources -->
            <!-- ordering is important here -->
            <filter>src/main/resources/application.properties</filter>
            <filter>${local.configFile}</filter>
        </filters>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-docs-sources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.3.0</version>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.n52.sensorweb-server.helgoland</groupId>
                                <artifactId>helgoland-web-resources</artifactId>
                                <includes>docs/**</includes>
                                <excludes>docs/_config.yml</excludes>
                                <overWrite>false</overWrite>
                                <outputDirectory>${docs.sources.directory}</outputDirectory>
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.n52.sensorweb-server.helgoland</groupId>
                                <artifactId>helgoland-web-resources</artifactId>
                                <includes>static/**</includes>
                                <overWrite>false</overWrite>
                                <outputDirectory>${webapp.workdir}</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                    <executions>
                        <execution>
                            <id>hibernate-mapping</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <usedDependencies>
                                    <usedDependency>org.springframework:spring-core</usedDependency>
                                </usedDependencies>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>org.n52.sensorweb-server.db-model</groupId>
                                        <artifactId>db-model-mappings</artifactId>
                                        <overWrite>false</overWrite>
                                    </artifactItem>
                                </artifactItems>
                                <includes>**/*.hbm.xml,**/README</includes>
                                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                <overWriteReleases>false</overWriteReleases>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.3.2</version>
                    <configuration>
                        <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                        <webappDirectory>${webappDirectory}</webappDirectory>
                        <webResources>
                            <resource>
                                <directory>src/main/resources</directory>
                                <targetPath>WEB-INF/classes</targetPath>
                                <filtering>true</filtering>
                            </resource>
                            <resource>
                                <directory>src/main/webapp</directory>
                                <filtering>true</filtering>
                                <excludes>
                                    <!-- spring beans are filtered via properties -->
                                    <exclude>WEB-INF/spring/**</exclude>
                                </excludes>
                            </resource>
                            <resource>
                                <directory>src/main/webapp</directory>
                                <filtering>true</filtering>
                                <includes>
                                    <!-- sets the properties file being used for filtering -->
                                    <include>WEB-INF/spring/dispatcher-servlet.xml</include>
                                </includes>
                            </resource>
                            <resource>
                                <directory>${webapp.workdir}</directory>
                                <filtering>true</filtering>
                                <excludes>
                                    <!-- exlude processed source files -->
                                    <exclude>docs-sources/**</exclude>
                                </excludes>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>11.0.12</version>
                    <configuration>
                        <stopKey>C</stopKey>
                        <stopPort>34343</stopPort>
                        <scanIntervalSeconds>0</scanIntervalSeconds>
                        <reload>manual</reload>
                        <webAppConfig>
                            <contextPath>/</contextPath>
                            <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
                        </webAppConfig>
                        <systemProperties>
                            <systemProperty>
                                <name>catalina.base</name>
                                <value>${project.build.directory}</value>
                            </systemProperty>
                        </systemProperties>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>with-docs</id>

            <activation>
                <os>
                    <family>!windows</family>
                </os>
                <property>
                    <name>docs</name>
                </property>
            </activation>

            <properties>
                <jekyll.port>4000</jekyll.port>
            </properties>

            <repositories>
                <!--Repository for ruby (Jekyll) gems -->
                <repository>
                    <id>rubygems-proxy</id>
                    <name>Rubygems Proxy</name>
                    <url>https://rubygems-proxy.torquebox.org/releases</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>

            <dependencies>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>activesupport</artifactId>
                    <version>6.0.2.1</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>addressable</artifactId>
                    <version>2.7.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>celluloid</artifactId>
                    <version>0.17.4</version>
                    <scope>provided</scope>
                    <type>gem</type>
                    <exclusions>
                        <exclusion>
                            <groupId>rubygems</groupId>
                            <artifactId>timers</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>celluloid-essentials</artifactId>
                    <version>0.20.5</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>celluloid-supervision</artifactId>
                    <version>0.20.6</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>coffee-script</artifactId>
                    <version>2.4.1</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>colorator</artifactId>
                    <version>1.1.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>ffi</artifactId>
                    <version>1.12.2</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>forwardable-extended</artifactId>
                    <version>2.6.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>github-pages</artifactId>
                    <version>204</version>
                    <scope>provided</scope>
                    <type>gem</type>
                    <exclusions>
                        <exclusion>
                            <groupId>rubygems</groupId>
                            <artifactId>jekyll-watch</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>html-pipeline</artifactId>
                    <version>2.12.3</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>i18n</artifactId>
                    <version>1.8.2</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>jekyll</artifactId>
                    <version>4.0.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                    <exclusions>
                        <exclusion>
                            <groupId>rubygems</groupId>
                            <artifactId>jekyll-watch</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>jekyll-sass-converter</artifactId>
                    <version>2.1.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>jekyll-sitemap</artifactId>
                    <version>1.4.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                    <exclusions>
                        <exclusion>
                            <groupId>rubygems</groupId>
                            <artifactId>jekyll-watch</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>jekyll-watch</artifactId>
                    <version>2.2.1</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>jemoji</artifactId>
                    <version>0.8.0</version>
                    <exclusions>
                        <exclusion>
                            <groupId>rubygems</groupId>
                            <artifactId>html-pipeline</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>kramdown</artifactId>
                    <version>2.1.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>listen</artifactId>
                    <version>3.2.1</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>liquid</artifactId>
                    <version>4.0.3</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>mercenary</artifactId>
                    <version>0.4.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>nokogiri</artifactId>
                    <version>1.10.8</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>pathutil</artifactId>
                    <version>0.16.2</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>rouge</artifactId>
                    <version>3.16.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>sass</artifactId>
                    <version>3.7.4</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
                <dependency>
                    <groupId>rubygems</groupId>
                    <artifactId>timers</artifactId>
                    <version>4.3.0</version>
                    <scope>provided</scope>
                    <type>gem</type>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <!-- assemble licenses -->
                        <groupId>org.jasig.maven</groupId>
                        <artifactId>maven-notice-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <!--Allow a definition of the gem repo -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <configuration>
                            <requireNoRepositories>
                                <allowedRepositories>
                                    <id>rubygems-proxy</id>
                                </allowedRepositories>
                            </requireNoRepositories>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>de.saumya.mojo</groupId>
                        <artifactId>gem-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>jekyll-build</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <file>${project.build.directory}/rubygems/bin/jekyll</file>
                                    <execArgs>build --baseurl /${docs.context} --source ${docs.sources.directory}/docs
                                        --destination ${docs.output.directory}</execArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <!-- run me with: mvn compile gem:exec@jekyll-serve (maven version >= 3.3.1 required) -->
                                <id>jekyll-serve</id>
                                <phase>none</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <file>${project.build.directory}/rubygems/bin/jekyll</file>
                                    <execArgs>serve --trace --incremental --watch --port ${jekyll.port} --baseurl
                                        /${docs.context} --source ${docs.sources.directory}/docs --destination
                                        ${docs.output.directory}</execArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

                <pluginManagement>
                    <plugins>
                        <plugin>
                            <!-- assemble licenses -->
                            <groupId>org.jasig.maven</groupId>
                            <artifactId>maven-notice-plugin</artifactId>
                            <configuration>
                                <licenseMapping>
                                    <param>../etc/license-mappings.xml</param>
                                    <param>http://52north.github.io/cdn/licenses/license-mappings.xml</param>
                                </licenseMapping>
                                <generateChildNotices>true</generateChildNotices>
                            </configuration>
                        </plugin>

                        <plugin>
                            <groupId>de.saumya.mojo</groupId>
                            <artifactId>gem-maven-plugin</artifactId>
                            <version>2.0.1</version>
                            <configuration>
                                <supportNative>true</supportNative>
                                <jrubyVersion>9.0.5.0</jrubyVersion>
                                <addProjectClasspath>true</addProjectClasspath>
                                <jrubyVerbose>false</jrubyVerbose>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
