<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2015 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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kie</groupId>
    <artifactId>kie-parent</artifactId>
    <version>7.60.0.Final</version>
  </parent>

  <groupId>org.optaplanner</groupId>
  <artifactId>optaplanner-wb</artifactId>
  <packaging>pom</packaging>

  <name>OptaPlanner Workbench</name>
  <description>OptaPlanner Workbench</description>
  <url>http://www.optaplanner.org</url>

  <properties>
    <spotbugs.failOnViolation>true</spotbugs.failOnViolation>
    <!-- The version greater than 1.0.0.GA is not compatible with GWT 2.8.x -->
    <version.javax.validation>1.0.0.GA</version.javax.validation>
  </properties>

  <repositories>
    <!-- Bootstrap repository to locate the parent pom when the parent pom has not been build locally. -->
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>

  <scm>
    <connection>scm:git:git@github.com:kiegroup/optaplanner-wb.git</connection>
    <developerConnection>scm:git:git@github.com:kiegroup/optaplanner-wb.git</developerConnection>
    <url>https://github.com/kiegroup/optaplanner-wb</url>
  </scm>
  <issueManagement>
    <system>jira</system>
    <url>https://issues.jboss.org/browse/PLANNER</url>
  </issueManagement>

  <modules>
    <module>optaplanner-wb-screens</module>
    <module>optaplanner-wb-ui</module>
    <module>optaplanner-wb-webapp</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.errai.bom</groupId>
        <artifactId>errai-internal-bom</artifactId>
        <version>${version.org.jboss.errai}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.uberfire</groupId>
        <artifactId>uberfire-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.optaplanner</groupId>
        <artifactId>optaplanner-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.kie.uberfire</groupId>
        <artifactId>kie-uberfire-extensions-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.kie.soup</groupId>
        <artifactId>kie-soup-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>net.ltgt.gwt.maven</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <configuration>
            <style>PRETTY</style>
            <logLevel>INFO</logLevel>
            <jvmArgs>
              <arg>-Xmx4g</arg>
            </jvmArgs>
            <!-- compile goal configuration, see https://tbroyer.github.io/gwt-maven-plugin/compile-mojo.html -->
            <compilerArgs>
              <arg>-strict</arg>
              <arg>-saveSource</arg>
              <arg>-saveSourceOutput</arg>
              <arg>extra</arg>
            </compilerArgs>
            <!-- codeserver goal configuration, see https://tbroyer.github.io/gwt-maven-plugin/codeserver-mojo.html -->
            <codeserverArgs>
              <arg>-strict</arg>
            </codeserverArgs>
            <!-- GWT Super Dev Mode: point codeserver to backend to overwrite *.nocache.js -->
            <launcherDir>optaplanner-wb-webapp/target/optaplanner-wb-webapp</launcherDir>
            <systemProperties>
              <!-- Write org/jboss/errai/ServerMarshallingFactoryImpl$Marshaller_*_Impl.class files
              to the WAR's WEB-INF/classes (needed during compilation) -->
              <errai.server.classOutput>${project.build.finalName}/WEB-INF/classes</errai.server.classOutput>
            </systemProperties>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!--Fix translations from Zanata -->
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <configuration>
          <includes>
            <include>**/*_de.properties</include>
            <include>**/*_es.properties</include>
            <include>**/*_fr.properties</include>
            <include>**/*_ja.properties</include>
            <include>**/*_pt_BR.properties</include>
            <include>**/*_zh_CN.properties</include>
          </includes>
          <excludes>
            <exclude>**/ErraiApp.properties</exclude>
          </excludes>
          <replacements>
            <replacement>
              <token>''</token>
              <value>'</value>
            </replacement>
            <replacement>
              <token>'</token>
              <value>''</value>
            </replacement>
          </replacements>
        </configuration>
      </plugin>

      <!-- Zanata - translations -->
      <plugin>
        <groupId>org.zanata</groupId>
        <artifactId>zanata-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}</directory>
              <includes>
                <include>.errai/**</include>
                <include>.niogit/**</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>

      <!-- Temporary workaround for https://issues.jboss.org/browse/ERRAI-1101. Needs to stay here until
        we find a general solution (e.g. moving all localized code to Errai TranslationService. -->
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>create-default-i18n-resource</id>
            <phase>process-resources</phase>
            <configuration>
              <target>
                <copy todir="${project.build.directory}/classes"
                      includeemptydirs="false" failonerror="false" quiet="true">
                  <fileset dir="${project.build.directory}/classes"/>
                  <globmapper from="*Constants.properties" to="*Constants_default.properties"/>
                </copy>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>
</project>
