<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2010 Marvin Herman Froeder (marvin@marvinformatics.com)

    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>io.takari.tycho</groupId>
    <artifactId>tycho-support</artifactId>
    <version>1.1.0</version>
  </parent>

  <groupId>com.marvinformatics.formatter</groupId>
  <artifactId>parent</artifactId>
  <version>2.2.0</version>
  <packaging>pom</packaging>

  <name>formatter-plugin</name>
  <description>Plugin for formatting source code</description>

  <prerequisites>
    <maven>3.0.5</maven>
  </prerequisites>

  <modules>
    <module>formatters</module>
    <module>maven-plugin</module>
    <module>maven-plugin-its</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <tychoVersion>1.0.0</tychoVersion>
    <plugin.version>3.5</plugin.version>
    <java.version>1.8</java.version>
    <tychoVersion>1.0.0</tychoVersion>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>${plugin.version}</version>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${plugin.version}</version>
          <configuration>
            <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
          </configuration>
          <executions>
            <execution>
              <id>mojo-descriptor</id>
              <goals>
                <goal>descriptor</goal>
              </goals>
            </execution>
            <execution>
              <id>help-goal</id>
              <goals>
                <goal>helpmojo</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
          <configuration>
            <skip>false</skip>
            <deployAtEnd>false</deployAtEnd>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.3</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>2.11</version>
          <configuration>
            <header>LICENSE.txt</header>
            <properties>
              <owner>Marvin Herman Froeder</owner>
              <email>marvin@marvinformatics.com</email>
            </properties>
            <excludes>
              <exclude>**/target/**</exclude>
              <exclude>**/README</exclude>
              <exclude>**/src/test/resources/**</exclude>
              <exclude>**/src/main/resources/**</exclude>
            </excludes>
            <useDefaultExcludes>false</useDefaultExcludes>
            <includes>
              <include>**/pom.xml</include>
              <include>**/*.xml</include>
              <include>**/*.xsd</include>
              <include>**/*.xjb</include>
              <include>**/*.mdo</include>
              <include>**/*.properties</include>
              <include>**/*.java</include>
              <include>**/*.groovy</include>
              <include>**/*.scala</include>
              <include>**/*.aj</include>
              <include>**/*.js</include>
              <include>**/*.css</include>
            </includes>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.7.6.201602180812</version>
        <configuration>
          <includes>
            <include>**/marvinformatics/*</include>
          </includes>
          <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
          <propertyName>utCoverage</propertyName>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <argLine>${utCoverage} -Xmx2G</argLine>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.marvinformatics.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
        <version>1.9.2</version>
        <inherited>false</inherited>
        <configuration>
          <sourceDirectory>${project.basedir}</sourceDirectory>
          <excludes>
            <exclude>**/target/**</exclude>
            <exclude>**/sample/**</exclude>
            <exclude>**/test/projects/**</exclude>
          </excludes>
          <lineEnding>LF</lineEnding>
          <configFile>${project.basedir}/src/config/eclipse/formatter/java.xml</configFile>
          <configJsFile>${project.basedir}/src/config/eclipse/formatter/javascript.xml</configJsFile>
        </configuration>
        <executions>
          <execution>
            <id>format</id>
            <goals>
              <goal>format</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.ekryd.sortpom</groupId>
        <artifactId>sortpom-maven-plugin</artifactId>
        <version>2.4.0</version>
        <configuration>
          <keepBlankLines>true</keepBlankLines>
          <lineSeparator>\n</lineSeparator>
          <predefinedSortOrder>custom_1</predefinedSortOrder>
          <createBackupFile>false</createBackupFile>
        </configuration>
        <executions>
          <execution>
            <id>format</id>
            <goals>
              <goal>sort</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <inherited>false</inherited>
        <executions>
          <execution>
            <id>format</id>
            <goals>
              <goal>format</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <failOnWarning>true</failOnWarning>
          <ignoreNonCompile>true</ignoreNonCompile>
        </configuration>
        <executions>
          <execution>
            <id>analyze</id>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <phase>process-classes</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>${plugin.version}</version>
      </plugin>
    </plugins>
  </reporting>

  <url>https://github.com/velo/maven-formatter-plugin/</url>

  <inceptionYear>2010</inceptionYear>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>velo</id>
      <name>Marvin Herman Froeder</name>
      <email>velo br at gmail dot com</email>
      <url>about.me/velo</url>
      <roles>
        <role>owner</role>
      </roles>
    </developer>
  </developers>
  <contributors>
    <contributor>
      <name>Jeremy Landis</name>
      <email>jeremylandis@hotmail.com</email>
      <url>http://www.linkedin.com/pub/jeremy-landis/19/b27/548/</url>
      <organization>hazendaz</organization>
      <organizationUrl>https://github.com/hazendaz</organizationUrl>
      <roles>
        <role>Developer</role>
      </roles>
      <timezone>-5</timezone>
      <properties>
        <picUrl>http://m.c.lnkd.licdn.com/mpr/mpr/shrink_200_200/p/1/000/128/174/30cff69.jpg</picUrl>
      </properties>
    </contributor>
    <contributor>
      <name>Jeremy Landis</name>
      <email>jeremylandis@hotmail.com</email>
      <url>http://www.linkedin.com/pub/jeremy-landis/19/b27/548/</url>
      <organization>hazendaz</organization>
      <organizationUrl>https://github.com/hazendaz</organizationUrl>
      <roles>
        <role>Developer</role>
      </roles>
      <timezone>-5</timezone>
      <properties>
        <picUrl>http://m.c.lnkd.licdn.com/mpr/mpr/shrink_200_200/p/1/000/128/174/30cff69.jpg</picUrl>
      </properties>
    </contributor>
  </contributors>

  <scm>
    <connection>scm:git:git://github.com/velo/maven-formatter-plugin.git</connection>
    <developerConnection>scm:git:https://github.com/velo/maven-formatter-plugin.git</developerConnection>
    <tag>HEAD</tag>
    <url>https://github.com/velo/maven-formatter-plugin/</url>
  </scm>

  <issueManagement>
    <system>github</system>
    <url>https://github.com/velo/maven-formatter-plugin/issues</url>
  </issueManagement>
  <ciManagement>
    <system>shippable</system>
    <url>https://app.shippable.com/projects/54cfaf705ab6cc13528a8b4c/builds/latest</url>
  </ciManagement>

  <repositories>
    <repository>
      <!-- must have id luna to override parent pom -->
      <id>luna</id>
      <url>http://download.eclipse.org/releases/oxygen/</url>
      <layout>p2</layout>
    </repository>
  </repositories>

  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <site>
      <id>gh-pages</id>
      <name>Formatter Maven Plugin GitHub Pages</name>
      <url>git:ssh://git@github.com/velo/formatter-maven-plugin.get?gh-pages#</url>
    </site>
  </distributionManagement>

  <profiles>
    <profile>

      <id>ci</id>

      <build>
        <plugins>
          <plugin>
            <groupId>com.marvinformatics.formatter</groupId>
            <artifactId>formatter-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>validate</id>
                <goals>
                  <goal>validate</goal>
                </goals>
                <phase>initialize</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>com.github.ekryd.sortpom</groupId>
            <artifactId>sortpom-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>validate</id>
                <goals>
                  <goal>verify</goal>
                </goals>
                <phase>initialize</phase>
              </execution>
            </executions>
          </plugin>

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

          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>validate</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>initialize</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>

      <id>skip-formatter</id>

      <build>
        <plugins>
          <plugin>
            <groupId>com.marvinformatics.formatter</groupId>
            <artifactId>formatter-maven-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>

      <id>release</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.7</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

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

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <configuration>
              <passphraseServerId>ossrh</passphraseServerId>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>license</id>
      <activation>
        <file>
          <missing>LICENSE.txt</missing>
        </file>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
