<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
         
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
--><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.incode</groupId>
        <artifactId>incode-build</artifactId>
        <version>2.5</version>
    </parent>

    <groupId>${groupId}</groupId>
    <artifactId>${artifactId}</artifactId>
    <version>${version}</version>

    <name>Apache Isis App - HelloWorld</name>

    <packaging>war</packaging>

    <properties>
        <revision>1.17.0</revision>
        <isis.version>${revision}</isis.version>

        <compiler-plugin.source>1.8</compiler-plugin.source>
        <compiler-plugin.target>1.8</compiler-plugin.target>
        <compiler-plugin.compilerArgument>-parameters</compiler-plugin.compilerArgument>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven-war-plugin.warName>${project.artifactId}</maven-war-plugin.warName>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>com.github.odavid.maven.plugins</groupId>
                <artifactId>mixin-maven-plugin</artifactId>
                <version>0.1-alpha-39</version>
                <extensions>true</extensions>
                <configuration>
                    <mixins>
                        <mixin>
                            <groupId>com.danhaywood.mavenmixin</groupId>
                            <artifactId>standard</artifactId>
                        </mixin>
                        <mixin>
                            <groupId>com.danhaywood.mavenmixin</groupId>
                            <artifactId>datanucleusenhance</artifactId>
                        </mixin>
                        <mixin>
                            <groupId>com.danhaywood.mavenmixin</groupId>
                            <artifactId>surefire</artifactId>
                        </mixin>
                        <mixin>
                            <groupId>com.danhaywood.mavenmixin</groupId>
                            <artifactId>jettywar</artifactId>
                        </mixin>
                    </mixins>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <updatePomFile>true</updatePomFile>
                    <pomElements>
                        <dependencyManagement>resolve</dependencyManagement>
                        <dependencies>resolve</dependencies>
                    </pomElements>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten.clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.isis.core</groupId>
                <artifactId>isis</artifactId>
                <version>${isis.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- ISIS API -->
        <dependency>
            <groupId>org.apache.isis.core</groupId>
            <artifactId>isis-core-applib</artifactId>
        </dependency>

        <!-- OTHER DEPENDENCIES -->
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.isis.mavendeps</groupId>
            <artifactId>isis-mavendeps-webapp</artifactId>
            <type>pom</type>
        </dependency>


        <!-- TEST DEPENDENCIES -->
        <dependency>
            <groupId>org.apache.isis.mavendeps</groupId>
            <artifactId>isis-mavendeps-testing</artifactId>
            <scope>test</scope>
            <type>pom</type>
        </dependency>

    </dependencies>

    <profiles>
        <profile>
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <directory>target-ide</directory>
                <plugins>
                    <!-- eclipse doesn't seem to support maven mixins config, so repeat here -->
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>${compiler-plugin.source}</source>
                            <target>${compiler-plugin.target}</target>
                            <compilerArgument />
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>skinny-war</id>
            <activation>
                <property>
                    <name>skinny-war</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>${maven-war-plugin.version}</version>
                        <configuration>
                            <warName>${maven-war-plugin.warName}</warName>
                            <packagingExcludes>%regex[WEB-INF/lib/(?!helloworld).*.jar]</packagingExcludes>
                            <archive>
                                <manifest>
                                    <addClasspath>false</addClasspath>
                                </manifest>
                                <manifestEntries>
                                    <Build-Time>${maven.build.timestamp}</Build-Time>
                                    <Build-Host>${agent.name}</Build-Host>
                                    <Build-User>${user.name}</Build-User>
                                    <Build-Maven>Maven ${maven.version}</Build-Maven>
                                    <Build-Java>${java.version}</Build-Java>
                                    <Build-OS>${os.name}</Build-OS>
                                    <Build-Label>${project.version}</Build-Label>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!--
        using:
        mvn -s .m2/settings.xml -D deploy-to-tomcat tomcat7:deploy-only
         -->
        <profile>
            <id>deploy-to-tomcat</id>
            <activation>
                <property>
                    <name>deploy-to-tomcat</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.2</version>
                        <configuration>
                            <url>http://localhost:8080/manager/text</url>
                            <server>tomcat-server</server>
                            <path>/ROOT</path>
                            <warFile>${project.build.directory}/${maven-war-plugin.warName}.war</warFile>
                            <update>true</update>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
