<?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>
  <groupId>com.vaadin</groupId>
  <artifactId>vaadin-parent</artifactId>
  <packaging>pom</packaging>
  <name>Vaadin parent POM</name>
  <version>2.1.0</version>
  <url>http://vaadin.com</url>
  <description>
      A parent POM for all artifacts by Vaadin Ltd.
  </description>
  <developers>
    <developer>
      <id>vaadin</id>
      <organization>Vaadin</organization>
      <organizationUrl>http://vaadin.com</organizationUrl>
    </developer>
  </developers>
  <scm>
    <url>https://github.com/vaadin/maven-integration</url>
    <connection>https://github.com/vaadin/maven-integration.git</connection>
    <developerConnection>https://github.com/vaadin/maven-integration.git</developerConnection>
  </scm>
  <licenses>
    <license>
      <name>Apache License Version 2.0</name>
      <distribution>repo</distribution>
      <url>https://www.apache.org/licenses/LICENSE-2.0</url>
    </license>
  </licenses>
  <distributionManagement>
    <repository>
      <id>vaadin-staging</id>
      <name>Vaadin release staging repository</name>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>vaadin-prereleases</id>
      <name>Vaadin snapshot repository</name>
      <url>https://maven.vaadin.com/vaadin-prereleases/</url>
    </snapshotRepository>
  </distributionManagement>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <profiles>
      <profile>
          <id>flatten-pom</id>
          <properties>
              <flatten.maven.plugin.version>1.1.0</flatten.maven.plugin.version>
          </properties>
          <!-- This profile is aming to flatten the pom of vaadin products. -->
          <!-- It should be used for product releases. -->
          <!-- Current target would be using it for stable releases. -->
          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.eclipse.m2e</groupId>
                          <artifactId>lifecycle-mapping</artifactId>
                          <version>1.0.0</version>
                          <configuration>
                              <lifecycleMappingMetadata>
                                  <pluginExecution>
                                      <pluginExecutionFilter>
                                          <groupId>org.codehaus.mojo</groupId>
                                          <artifactId>flatten-maven-plugin</artifactId>
                                          <versionRange>[1,)</versionRange>
                                          <goals>
                                              <goal>flatten</goal>
                                          </goals>
                                      </pluginExecutionFilter>
                                      <action>
                                          <ignore />
                                      </action>
                                  </pluginExecution>
                              </lifecycleMappingMetadata>
                          </configuration>
                      </plugin>
                      <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>flatten-maven-plugin</artifactId>
                          <version>${flatten.maven.plugin.version}</version>
                          <inherited>true</inherited>
                          <executions>
                              <execution>
                                  <!-- Flatten and simplify our own POM for install/deploy -->
                                  <id>flatten</id>
                                  <phase>process-resources</phase>
                                  <goals>
                                      <goal>flatten</goal>
                                  </goals>
                                  <configuration>
                                      <updatePomFile>true</updatePomFile>
                                      <pomElements>
                                          <parent>expand</parent>
                                          <name>keep</name>
                                          <description>keep</description>
                                          <url>keep</url>
                                          <properties>keep</properties>
                                          <pluginManagement>keep</pluginManagement>
                                          <dependencyManagement>keep</dependencyManagement>
                                          <build>keep</build>
                                      </pomElements>
                                  </configuration>
                              </execution>
                              <execution>
                                  <id>flatten-clean</id>
                                  <phase>clean</phase>
                                  <goals>
                                      <goal>clean</goal>
                                  </goals>
                              </execution>
                          </executions>
                      </plugin>
                  </plugins>
              </pluginManagement>

              <plugins>
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>flatten-maven-plugin</artifactId>
                  </plugin>
              </plugins>
          </build>
      </profile>
    <profile>
      <id>release</id>
      <properties>
        <maven.enforcer.plugin.version>3.0.0</maven.enforcer.plugin.version>
        <maven.gpg.plugin.version>3.0.1</maven.gpg.plugin.version>
        <nexus.staging.maven.plugin.version>1.6.13</nexus.staging.maven.plugin.version>
        <staging.server.id>vaadin-staging</staging.server.id>
        <staging.server.url>https://oss.sonatype.org/</staging.server.url>
        <staging.timeout.minutes>5</staging.timeout.minutes>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0.0</version>
            <configuration>
              <quiet>true</quiet>
            </configuration>
            <executions>
              <execution>
                <phase>initialize</phase>
                <goals>
                  <goal>read-project-properties</goal>
                </goals>
                <configuration>
                  <files>
                    <file>${gpg.passphrase.file}</file>
                  </files>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <!--This plugin's version is upgraded to resolve conflicts as flow project is using 3.0.0.-->
            <version>${maven.enforcer.plugin.version}</version>
            <executions>
              <execution>
                <id>enforce-maven</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireMavenVersion>
                      <version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
                      <message>
                        Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums
                        respectively.
                      </message>
                    </requireMavenVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
             <groupId>org.sonatype.plugins</groupId>
             <artifactId>nexus-staging-maven-plugin</artifactId>
             <version>${nexus.staging.maven.plugin.version}</version>
             <extensions>true</extensions>
             <configuration>
               <nexusUrl>${staging.server.url}</nexusUrl>
               <serverId>${staging.server.id}</serverId>
               <stagingProgressTimeoutMinutes>${staging.timeout.minutes}</stagingProgressTimeoutMinutes>
             </configuration>
           </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>prerelease</id>
      <properties>
        <staging.server.id>vaadin-prerelease-staging</staging.server.id>
        <maven.enforcer.plugin.version>3.0.0</maven.enforcer.plugin.version>
        <maven.gpg.plugin.version>3.0.1</maven.gpg.plugin.version>
        <nexus.staging.maven.plugin.version>1.6.13</nexus.staging.maven.plugin.version>
        <!-- staging.server.url is set by the build environment profile -->
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0.0</version>
            <configuration>
              <quiet>true</quiet>
            </configuration>
            <executions>
              <execution>
                <phase>initialize</phase>
                <goals>
                  <goal>read-project-properties</goal>
                </goals>
                <configuration>
                  <files>
                    <file>${gpg.passphrase.file}</file>
                  </files>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <!--This plugin's version is upgraded to resolve conflicts as flow project is using 3.0.0.-->
            <version>${maven.enforcer.plugin.version}</version>
            <executions>
              <execution>
                <id>enforce-maven</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireMavenVersion>
                      <version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
                      <message>
                        Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums
                        respectively.
                      </message>
                    </requireMavenVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
             <groupId>org.sonatype.plugins</groupId>
             <artifactId>nexus-staging-maven-plugin</artifactId>
             <version>${nexus.staging.maven.plugin.version}</version>
             <extensions>true</extensions>
             <configuration>
               <nexusUrl>${staging.server.url}</nexusUrl>
               <serverId>${staging.server.id}</serverId>
             </configuration>
           </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
        <id>apicmp</id>
        <properties>
            <japicmp.maven.plugin.version>0.16.0</japicmp.maven.plugin.version>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.siom79.japicmp</groupId>
                    <artifactId>japicmp-maven-plugin</artifactId>
                    <version>${japicmp.maven.plugin.version}</version>
                    <configuration>
                        <oldVersion>
                            <dependency>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <!--  Needs to be passed as a property via command line e.g. -->
                                <version>${api.reference.version}</version>
                                <type>jar</type>
                            </dependency>
                        </oldVersion>
                        <newVersion>
                            <file>
                                <path>${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging}</path>
                            </file>
                        </newVersion>
                        <parameter>
                            <ignoreMissingClasses>true</ignoreMissingClasses>
                            <onlyModified>true</onlyModified>
                            <skipDiffReport>true</skipDiffReport>
                            <skipXmlReport>true</skipXmlReport>
                            <ignoreMissingOldVersion>true</ignoreMissingOldVersion>
                            <ignoreMissingNewVersion>true</ignoreMissingNewVersion>
                        </parameter>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>cmp</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
  </profiles>

  <build>
    <pluginManagement>
      <plugins>
        <!--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>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>properties-maven-plugin</artifactId>
                    <versionRange>[1.0-alpha-2,)</versionRange>
                    <goals>
                      <goal>read-project-properties</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
