<?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.kie</groupId>
    <artifactId>kie-parent</artifactId>
    <version>7.32.0.Final</version>
  </parent>

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

  <name>Drools Workbench</name>
  <description>Drools Workbench</description>

  <properties>
    <checkstyle.header.template><![CDATA[
^\/\*$\n^
\* Copyright \d\d\d\d Red Hat, Inc\. and\/or its affiliates\.$\n^
\*$\n^
\* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\);$\n^
\* you may not use this file except in compliance with the License\.$\n^
\* You may obtain a copy of the License at$\n^
\*$\n^
\*     http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0$\n^
\*$\n^
\* Unless required by applicable law or agreed to in writing, software$\n^
\* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,$\n^
\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$\n^
\* See the License for the specific language governing permissions and$\n^
\* limitations under the License\.$\n^
\*\/$
]]>
    </checkstyle.header.template>
    <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
    <checkstyle.logViolationsToConsole>true</checkstyle.logViolationsToConsole>
    <jacoco.haltOnFailure>false</jacoco.haltOnFailure>
    <spotbugs.failOnViolation>true</spotbugs.failOnViolation>
    <!-- JaCoCo coverage data file location. Using a single file for appending in the project's root directory makes it
       possible to measure cross-module test coverage -->
    <!--suppress UnresolvedMavenProperty -->
    <code.coverage.disabled>false</code.coverage.disabled>
    <!-- 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>

  <modules>
    <module>drools-wb-services</module>
    <module>drools-wb-screens</module>
    <module>drools-wb-webapp</module>
    <module>drools-wb-extensions</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.soup</groupId>
        <artifactId>kie-soup-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.jbpm</groupId>
        <artifactId>jbpm-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-dmn-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.powermock</groupId>
        <artifactId>powermock-core</artifactId>
        <version>${version.org.powermock}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <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>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze-only</id>
            <phase>verify</phase> <!-- it is anyway the default -->
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <configuration>
              <verbose>true</verbose>
              <!-- The following lines are the original configuration of the replaced  IllegalTransitiveCheck rule.
              We are keeping them here because we want to recreate them as similar as possible, even if they follow a different semantics -->
              <!--
               <regexIgnoredClass>org\.jboss\.errai\.marshalling\.server\.impl\.ServerMarshallingFactory.*</regexIgnoredClass>
                    <regexIgnoredClass>io\.fabric8\.kubernetes.*</regexIgnoredClass>
                    <regexIgnoredClass>io\.fabric8\.openshift.*</regexIgnoredClass>
                    <regexIgnoredClass>com\.sun\.net\.httpserver\..+</regexIgnoredClass>
                    <regexIgnoredClass>javax\..+</regexIgnoredClass>
                    <regexIgnoredClass>org\.w3c\.dom\..+</regexIgnoredClass>
                    <regexIgnoredClass>org\.xml\.sax\..+</regexIgnoredClass>
              -->
              <ignoredUsedUndeclaredDependencies>
                <!-- List of dependencies that will be ignored if they are used but undeclared. -->
                <!-- For the moment being, manually add one-by-one. Next step will be to identify a pattern
                 equivalent to the regexp used previously -->
                <dependency>
                  org.gwtbootstrap3:gwtbootstrap3
                </dependency>
                <dependency>
                  javax.*
                </dependency>
                <dependency>
                  org.slf4j:*
                </dependency>
                <dependency>
                  org.uberfire:uberfire-nio2-model
                </dependency>
                <dependency>
                  org.jboss.errai:*
                </dependency>
                <dependency>
                  org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec
                </dependency>
                <dependency>
                  org.apache.lucene:lucene-core
                </dependency>
                <dependency>
                  commons-io:*
                </dependency>
                <dependency>
                  org.jgroups:*
                </dependency>
                <dependency>
                  org.apache.commons:*
                </dependency>
              </ignoredUsedUndeclaredDependencies>
              <ignoredUnusedDeclaredDependencies>
              <dependency>
                <!-- We have to skip'em all for two reasons:
                1) some/most of them are inherited, not explicitly declared, so they should be "excluded" from inherited dependency,
                2) some/most of them are required at runtime by showcases, so it is not possible to detect them at build time
                Please remember primary scope of this configuration it is to (try to) avoid code breakage if inheritance tree changes.
                -->
                *:*
              </dependency>
              </ignoredUnusedDeclaredDependencies>
              <failOnWarning>true</failOnWarning>
              <!-- other configurations here -->
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

  <profiles>
    <profile>
      <id>run-code-coverage</id>
      <properties>
        <jacoco.excludes>*Lexer</jacoco.excludes>
      </properties>

      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.agent</artifactId>
            <classifier>runtime</classifier>
            <version>${version.jacoco.plugin}</version>
            <scope>test</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.jacoco</groupId>
          <artifactId>org.jacoco.agent</artifactId>
          <classifier>runtime</classifier>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.jacoco</groupId>
              <artifactId>jacoco-maven-plugin</artifactId>
              <version>${version.jacoco.plugin}</version>
              <configuration>
                <append>true</append>
                <dataFile>${jacoco.exec.file}</dataFile>
                <excludes>
                  <exclude>${jacoco.excludes}</exclude>
                </excludes>
              </configuration>
              <executions>
                <execution>
                  <id>default-instrument</id>
                  <goals>
                    <goal>instrument</goal>
                  </goals>
                </execution>
                <execution>
                  <id>default-restore-instrumented-classes</id>
                  <goals>
                    <goal>restore-instrumented-classes</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>gwt-maven-plugin</artifactId>
              <configuration>
                <skip>true</skip>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <systemPropertyVariables>
                  <jacoco-agent.destfile>${jacoco.exec.file}</jacoco-agent.destfile>
                </systemPropertyVariables>
                <skip>${code.coverage.disabled}</skip>
              </configuration>
                   </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <configuration>
              <skip>${code.coverage.disabled}</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
