<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.
  ~  
  ~ Licensed 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/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>uberfire-security-management</artifactId>
    <groupId>org.uberfire</groupId>
    <version>0.9.0.Final</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>uberfire-security-management-webapp</artifactId>
  <packaging>war</packaging>
  <name>Uberfire Security Management - Users and groups management Webapp</name>
  <description>Uberfire Security Management - Users and groups management Webapp</description>

  <properties>
    <errai.version>${version.org.jboss.errai}</errai.version>
    <as.version>8.1.0.Final</as.version>
    <errai.jboss.home>${project.build.directory}/wildfly-${as.version}</errai.jboss.home>
  </properties>

  <dependencies>
    
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-widgets-service-backend</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-backend-api</artifactId>
    </dependency>

    <!-- dependencies added because of new illegal transitive dependency check -->
    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-ioc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-commons</artifactId>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-io</artifactId>
    </dependency>

    <!--Logs-->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-ext</artifactId>
    </dependency>

    <!-- This is a war file, so logback is not in scope test, but in scope compile -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
    </dependency>

    <!-- Security Management. -->
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-backend</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-keycloak</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-wildfly8</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-tomcat</artifactId>
    </dependency>
    
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-widgets-security-management</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-management-client-wb</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- UberFire -->
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-all</artifactId>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-backend-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-backend-cdi</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-workbench-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-servlet-security</artifactId>
    </dependency>
    
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-security-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-js</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-workbench-client-backend</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-client-backend</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-client-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-ui</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-security-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-security-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-navigation</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-widgets-properties-editor-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-widgets-commons</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-weld-integration</artifactId>
    </dependency>

    <dependency>
      <groupId>org.owasp.encoder</groupId>
      <artifactId>encoder</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-workbench-processors</artifactId>
      <scope>provided</scope>
    </dependency>


    <!-- UberFire Plugins Extension -->
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-runtime-plugins-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-runtime-plugins-backend</artifactId>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-runtime-plugins-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- UberFire Commons Editor -->
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-commons-editor-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-commons-editor-client</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-commons-editor-backend</artifactId>
    </dependency>

    <!-- Layout Editor API -->
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-layout-editor-api</artifactId>
    </dependency>

    <!-- UberFire Apps -->
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-apps-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-apps-client</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-apps-backend</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-jboss-as-support</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-cdi-jboss</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-codegen-gwt</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <scope>provided</scope>
    </dependency>

  </dependencies>

  <build>
    <finalName>${project.artifactId}</finalName>
    <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>

    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <configuration>
          <strict>true</strict>
          <localWorkers>1</localWorkers>
          <deploy>${project.build.directory}/gwt-symbols-deploy</deploy>
          <extraJvmArgs>-Xmx1g -XX:MaxPermSize=256m -Xms512m -XX:PermSize=128m -Xss1M -XX:CompileThreshold=7000 -Derrai.jboss.home=${errai.jboss.home} -Dorg.uberfire.ext.security.management.api.userManagementServices=WildflyCLIUserManagementService -Dorg.uberfire.ext.security.management.wildfly.cli.host=localhost -Dorg.uberfire.ext.security.management.wildfly.cli.port=9990 -Dorg.uberfire.ext.security.management.wildfly.cli.user=admin -Dorg.uberfire.ext.security.management.wildfly.cli.password=admin -Dorg.uberfire.ext.security.management.wildfly.cli.realm=ApplicationRealm</extraJvmArgs>
          <module>org.uberfire.ext.security.management.FastCompiledUberfireSecurityManagementShowcase</module>
          <logLevel>INFO</logLevel>
          <noServer>false</noServer>
          <server>org.jboss.errai.cdi.server.gwt.EmbeddedWildFlyLauncher</server>
          <disableCastChecking>true</disableCastChecking>
          <runTarget>security-management.html</runTarget>
          <hostedWebapp>src/main/webapp</hostedWebapp>
          <logLevel>INFO</logLevel>
          <compileSourcesArtifacts>
            <!-- UberFire -->
            <compileSourcesArtifact>org.uberfire:uberfire-commons</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-nio2-model</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-io</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-js</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-security-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-security-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-client-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-backend</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-views-patternfly</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-backend-api</compileSourcesArtifact>

            <!-- UF-ext -->
            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-apps-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-apps-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-widgets-commons</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-widgets-service-api</compileSourcesArtifact>

            <!-- Security Management -->
            <compileSourcesArtifact>org.uberfire:uberfire-security-management-api</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-security-management-client</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-security-management-client-wb</compileSourcesArtifact>
            <compileSourcesArtifact>org.uberfire:uberfire-widgets-security-management</compileSourcesArtifact>
            
          </compileSourcesArtifacts>
        </configuration>
        <executions>
          <execution>
            <id>gwt-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
          <execution>
            <id>gwt-compile</id>
            <goals>
              <goal>resources</goal>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>process-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.wildfly</groupId>
                  <artifactId>wildfly-dist</artifactId>
                  <version>${as.version}</version>
                  <type>zip</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}</directory>
              <includes>
                <include>src/main/webapp/org.uberfire.ext.security.management.UberfireSecurityManagementShowcase</include>
                <include>src/main/webapp/WEB-INF/deploy/</include>
                <include>src/main/webapp/WEB-INF/classes/</include>
                <include>src/main/webapp/WEB-INF/lib/</include>
                <include>**/gwt-unitCache/**</include>
                <include>.errai/</include>
                <include>.niogit/**</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <versionRange>[2.3.0,)</versionRange>
                    <goals>
                      <goal>resources</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute/>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>fullProfile</id>

      <activation>
        <property>
          <name>full</name>
        </property>
      </activation>

      <dependencies>
        <!-- Add back ANT when building full profile as it's needed by AS7 and Tomcat -->
        <dependency>
          <groupId>org.apache.ant</groupId>
          <artifactId>ant</artifactId>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin><!-- Keep in sync with soa profile -->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <configuration>
              <!-- Build all GWT permutations and optimize them -->
              <module>org.uberfire.ext.security.management.UberfireSecurityManagementShowcase</module>
              <draftCompile>false</draftCompile>
              <localWorkers>4</localWorkers>
              <extraJvmArgs>-Xmx1g -XX:MaxPermSize=256m -Xms512m -XX:PermSize=128m -Xss1M</extraJvmArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>


</project>