<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jboss.integration-platform</groupId>
    <artifactId>jboss-integration-platform-parent</artifactId>
    <!-- Keep in sync with property <version.org.jboss.integration-platform> in uberfire-parent-with-dependencies -->
    <version>6.0.6.Final</version>
  </parent>

  <groupId>org.uberfire</groupId>
  <artifactId>uberfire-parent-metadata</artifactId>
  <version>0.8.0.Final</version>
  <packaging>pom</packaging>

  <name>UberFire parent metadata</name>
  <description>
    The metadata parent contains all parent metadata (including plugins) except for dependency versions.
    This is to avoid a chicken-and-egg problem with the user BOM(s).
  </description>
  <inceptionYear>2012</inceptionYear>
  <organization>
    <name>JBoss by Red Hat</name>
    <url>http://www.jboss.org/</url>
  </organization>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <!-- IMPORTANT: Do not declare any external dependencies versions here! Declare them in uberfire-parent-with-dependencies. -->
    <uberfire.version>${project.version}</uberfire.version>
    <!-- Exception as it is needed for gwt-maven-plugin version-->
    <version.com.google.gwt>2.7.0</version.com.google.gwt>
    <!-- Override version 2.5.4 coming from jboss-parent:19 as it forks executions, which is a bug.
         See https://issues.apache.org/jira/browse/FELIX-4882 for more details. -->
    <version.bundle.plugin>3.0.1</version.bundle.plugin>
    <!-- Make OSGi happy -->
    <osgi.snapshot.qualifier>${maven.build.timestamp}</osgi.snapshot.qualifier>
    <!-- TODO fix all the modules to have all direct dependencies specified, then remove this property -->
    <illegaltransitivereportonly>true</illegaltransitivereportonly>
  </properties>

  <repositories>
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <scm>
    <connection>scm:git:git@github.com:uberfire/uberfire.git</connection>
    <developerConnection>scm:git:git@github.com:uberfire/uberfire.git</developerConnection>
    <url>https://github.com/uberfire/uberfire</url>
  </scm>
  <issueManagement>
    <system>jira</system>
    <url>https://issues.jboss.org/browse/UF</url>
  </issueManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>1.0-beta-4-jbossorg-1</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>ban-unwanted-logging-deps</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <phase>validate</phase>
              <configuration>
                <rules>
                  <bannedDependencies>
                    <excludes>
                      <!-- In case of transitive dependency, exclude it and use jcl-over-slf4j instead -->
                      <exclude>commons-logging:commons-log*</exclude>
                      <!-- In case of transitive dependency, exclude it and use log4j-over-slf4j instead -->
                      <exclude>log4j:log4j</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
            <execution>
              <id>ban-duplicated-classes</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <phase>validate</phase>
              <configuration>
                <rules>
                  <banDuplicateClasses>
                    <ignoreClasses>
                      <!-- Classes bundled in errai-javax-enterprise which are GWT friendly.
                           See https://github.com/errai/errai/blob/master/errai-javax-enterprise/README -->
                      <ignoreClass>javax.interceptor.InvocationContext</ignoreClass>
                      <ignoreClass>javax.inject.Provider</ignoreClass>
                      <ignoreClass>javax.inject.Named</ignoreClass>
                      <ignoreClass>javax.inject.Scope</ignoreClass>
                      <ignoreClass>javax.inject.Qualifier</ignoreClass>
                      <ignoreClass>javax.enterprise.*</ignoreClass>
                      <!-- Classes from gwt-user duplicated in errai-uibinder -->
                      <ignoreClass>com.google.gwt.uibinder.rebind.UiBinderWriter</ignoreClass>
                      <ignoreClass>com.google.gwt.uibinder.rebind.UiBinderGenerator</ignoreClass>
                      <!-- Duplicated by XStream's transitive deps, with very little chance to get properly fixed -->
                      <ignoreClass>org.xmlpull.v1.XmlPullParserException</ignoreClass>
                      <ignoreClass>org.xmlpull.v1.XmlPullParser</ignoreClass>
                    </ignoreClasses>
                    <dependencies>
                      <!-- gwt-dev bundles dozens of different 3rd party dependencies, but can not be usually excluded
                           as e.g. GWT Mockito tests are using the com.google.gwt classes inside. Ignoring it for the
                           duplicate classes check seems to be the only way. -->
                      <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <type>jar</type>
                        <ignoreClasses>
                          <ignoreClass>*</ignoreClass>
                        </ignoreClasses>
                      </dependency>
                      <!-- gwt-user bundles javax.servlet classes which usually conflicts with the servlet dependencies
                           in -webapp modules. -->
                      <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <type>jar</type>
                        <ignoreClasses>
                          <ignoreClass>javax.servlet.*</ignoreClass>
                        </ignoreClasses>
                      </dependency>
                    </dependencies>
                    <findAllDuplicates>true</findAllDuplicates>
                  </banDuplicateClasses>
                </rules>
                <fail>true</fail>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>parse-version</goal>
              </goals>
            </execution>
            <execution>
              <id>add-source</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>add-source</goal>
              </goals>
              <configuration>
                <sources>
                  <source>target/generated-sources/annotations</source>
                </sources>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>animal-sniffer-maven-plugin</artifactId>
          <version>1.13</version>
          <dependencies>
            <!-- Upgrade ASM and support Java 8 bytecode -->
            <!-- This is a workaround as it is already fixed in version 1.14.
                 However, that one fails with NPE for even simple cases, so it can't be used -->
            <dependency>
              <groupId>org.ow2.asm</groupId>
              <artifactId>asm-all</artifactId>
              <version>5.0.3</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>check-java-1.6-compatibility</id>
              <phase>test-compile</phase>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <signature>
                  <groupId>org.codehaus.mojo.signature</groupId>
                  <artifactId>java16</artifactId>
                  <version>1.1</version>
                </signature>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <fork>true</fork>
            <meminitial>128m</meminitial>
            <maxmem>512m</maxmem>
            <showDeprecation>true</showDeprecation>
            <showWarnings>true</showWarnings>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <version>${version.com.google.gwt}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <extensions>true</extensions>
          <configuration>
            <!-- Split packages in combination with <Export-Package> causes bloated jars otherwise -->
            <excludeDependencies>true</excludeDependencies>
            <instructions>
              <_removeheaders>Ignore-Package</_removeheaders>
              <_nouses>true</_nouses>
              <_snapshot>${osgi.snapshot.qualifier}</_snapshot>
              <Bundle-Version>
                ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}
              </Bundle-Version>
            </instructions>
            <obrRepository>NONE</obrRepository>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.jboss.errai</groupId>
          <artifactId>jacoco-gwt-maven-plugin</artifactId>
          <version>0.5.4.201202141554</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <systemPropertyVariables>
              <org.uberfire.nio.git.daemon.enabled>false</org.uberfire.nio.git.daemon.enabled>
              <org.uberfire.nio.git.ssh.enabled>false</org.uberfire.nio.git.ssh.enabled>
              <org.uberfire.sys.repo.monitor.disabled>true</org.uberfire.sys.repo.monitor.disabled>
            </systemPropertyVariables>
            <includes>
              <include>**/*Test.java</include>
            </includes>
            <excludes>
              <exclude>**/*IntegrationTest.java</exclude>
            </excludes>
            <argLine>-Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 ${jacocoArgs}</argLine>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <includes>
              <include>**/*IntegrationTest.java</include>
            </includes>
            <argLine>-Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8</argLine>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
              <configuration>
                <archive>
                  <manifestEntries>
                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                    <Bundle-SymbolicName>${project.artifactId}.source</Bundle-SymbolicName>
                    <Bundle-Version>
                      ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}
                    </Bundle-Version>
                    <Bundle-Name>${project.name}</Bundle-Name>
                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                    <Eclipse-SourceBundle>
                      ${project.artifactId};version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}";roots:="."
                    </Eclipse-SourceBundle>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
            <execution>
              <id>attach-test-sources</id>
              <goals>
                <goal>test-jar-no-fork</goal>
              </goals>
              <configuration>
                <archive>
                  <manifestEntries>
                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                    <Bundle-SymbolicName>${project.artifactId}.tests.source</Bundle-SymbolicName>
                    <Bundle-Version>
                      ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}
                    </Bundle-Version>
                    <Bundle-Name>${project.name}</Bundle-Name>
                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                    <Eclipse-SourceBundle>
                      ${project.artifactId}.tests;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}";roots:="."
                    </Eclipse-SourceBundle>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>2.2</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <configuration>
            <!-- Manually push changes (including git tags) after nexus staged
                 repo is successfully closed -->
            <pushChanges>false</pushChanges>
            <autoVersionSubmodules>true</autoVersionSubmodules>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <links>
              <link>http://docs.oracle.com/javase/6/docs/api</link>
            </links>
            <minmemory>128m</minmemory>
            <maxmemory>512m</maxmemory>
            <author>false</author>
            <breakiterator>true</breakiterator>
            <quiet>true</quiet>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <executions>
            <!-- No OSGi manifestEntries for <goal>jar</goal>: if it supported, then felix has already added them -->
            <execution>
              <id>attach-test-jar</id>
              <goals>
                <goal>test-jar</goal>
              </goals>
              <configuration>
                <excludes>
                  <exclude>**/logback-test.xml</exclude>
                  <exclude>**/jndi.properties</exclude>
                </excludes>
                <archive>
                  <manifestEntries>
                    <Bundle-SymbolicName>${project.artifactId}.tests</Bundle-SymbolicName>
                    <Bundle-Version>
                      ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}
                    </Bundle-Version>
                    <Bundle-Name>${project.name}</Bundle-Name>
                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <archive>
              <manifest>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>

        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <!-- Important: do not remove the lifecycle-mapping plugin version (even if already coming from parent)!
               This is to workaround bug in Eclipse m2e: https://bugs.eclipse.org/bugs/show_bug.cgi?id=371618 -->
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <versionRange>[1.7,)</versionRange>
                    <goals>
                      <goal>parse-version</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore/>
                  </action>
                </pluginExecution>
                <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>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.jboss.errai</groupId>
                    <artifactId>jacoco-gwt-maven-plugin</artifactId>
                    <versionRange>[0.0,)</versionRange>
                    <goals>
                      <goal>prepare-agent</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore/>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>

      </plugins>

    </pluginManagement>

    <plugins>
      <plugin>
        <!-- Entry needed to provide parsed version properties -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}</directory>
              <includes>
                <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>

      <!--Fix translations from Zanata -->
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.2</version>
        <configuration>
          <includes>
            <include>**/*Constants_de.properties</include>
            <include>**/*Constants_es.properties</include>
            <include>**/*Constants_fr.properties</include>
            <include>**/*Constants_ja.properties</include>
            <include>**/*Constants_pt_BR.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>
        <version>2.3.0</version>
        <configuration>
          <excludes>**/ErraiApp.properties</excludes>
          <projectConfig>${session.executionRootDirectory}/src/main/config/zanata.xml</projectConfig>
          <srcDir>src/main/resources/</srcDir>
          <transDir>src/main/resources/</transDir>
          <includes>**/*Constants.properties</includes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jboss.errai</groupId>
        <artifactId>jacoco-gwt-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>jacoco-initialize</id>
            <phase>initialize</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <propertyName>jacocoArgs</propertyName>
              <excludes>
                <exclude>com.sun.*</exclude>
              </excludes>
            </configuration>
          </execution>
          <execution>
            <id>jacoco-site</id>
            <phase>site</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!-- Entry needed to create test-jars even for packaging types war, bundle, ... -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>

    </plugins>

  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>org/uberfire/build/uberfire_checks.xml</configLocation>
          <headerLocation>org/uberfire/build/uberfire_license_header.txt</headerLocation>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>fullProfile</id>
      <activation>
        <property>
          <name>full</name>
        </property>
      </activation>
      <modules>
        <module>uberfire-distro</module>
      </modules>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>animal-sniffer-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>graph</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.fusesource.mvnplugins</groupId>
            <artifactId>maven-graph-plugin</artifactId>
            <version>1.38</version>
            <configuration>
              <hideExternal>true</hideExternal>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <modules>
    <module>uberfire-archetype</module>
    <module>uberfire-bom</module>
    <module>uberfire-parent-with-dependencies</module>
    <module>uberfire-commons</module>
    <module>uberfire-api</module>
    <module>uberfire-client-api</module>
    <module>uberfire-security</module>
    <module>uberfire-nio2-backport</module>
    <module>uberfire-io</module>
    <module>uberfire-server</module>
    <module>uberfire-backend</module>
    <module>uberfire-js</module>
    <module>uberfire-workbench</module>
    <module>uberfire-testing-utils</module>
    <module>uberfire-packaging</module>
    <module>uberfire-showcase</module>
  </modules>

  <!-- IMPORTANT: Do not declare any dependencies here! Declare them in uberfire-parent-with-dependencies. -->
  <!-- Intentionally empty -->
  <dependencyManagement/>
  <!-- Intentionally empty -->
  <dependencies/>

  <!-- DistributionManagement is inherited from org.jboss:jboss-parent -->
  <!-- <distributionManagement/> -->

</project>
