<?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.kie.workbench</groupId>
  <artifactId>kie-wb-common</artifactId>
  <packaging>pom</packaging>

  <name>Kie Workbench - Common</name>
  <description>Kie Workbench - Common</description>

  <modules>
    <module>kie-wb-common-profile</module>
    <module>kie-wb-common-widgets</module>
    <module>kie-wb-testing-utils</module>
    <module>kie-wb-common-screens</module>
    <module>kie-wb-common-services</module>
    <module>kie-wb-common-forms</module>
    <module>kie-wb-common-stunner</module>
    <module>kie-wb-common-dmn</module>
    <module>kie-wb-common-ala</module>
    <module>kie-wb-common-cli</module>
    <module>kie-wb-common-dev</module>
    <module>kie-wb-common-command-api</module>
    <module>kie-wb-common-kogito</module>
  </modules>

  <properties>
      <!-- Version 2.0.1.Final which is coming from kie-parent is not compatible with appformer validation components -->
    <version.javax.validation>1.0.0.GA</version.javax.validation>
    <spotbugs.failOnViolation>true</spotbugs.failOnViolation>
    <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>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.errai</groupId>
        <artifactId>wildfly-dist</artifactId>
        <version>${version.org.jboss.errai.wildfly}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <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>com.google.elemental2</groupId>
        <artifactId>elemental2-dom</artifactId>
        <version>${version.com.google.elemental2}</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.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.kie</groupId>
        <artifactId>kie-dmn-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.uberfire</groupId>
        <artifactId>kie-uberfire-extensions-bom</artifactId>
        <version>${version.org.kie}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

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

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

      <!-- Tests that use a M2 Repository create their files in different places depending on how they are ran - IDE or CLI -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}</directory>
              <includes>
                <include>repository/**</include>
                <include>.niogit/**</include>
                <include>.index/**</include>
                <include>.security/**</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>

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

      <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>
                <destFile>${jacoco.exec.file}</destFile>
                <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>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <systemPropertyVariables>
                  <jacoco-agent.destfile>${jacoco.exec.file}</jacoco-agent.destfile>
                </systemPropertyVariables>
              </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>
