<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2015 The original authors.

     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>

    <groupId>io.sundr</groupId>
    <artifactId>sundr-pom</artifactId>
    <packaging>pom</packaging>
    <version>0.93.2</version>
    <name>Sundrio :: POM</name>
    
    <description>Code generation tools and annotation processors for Builder, Fluent APIs and DSLs.</description>
    <url>https://github.com/sundrio/sundrio</url>
    <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>
    <scm>
        <connection>scm:git:git://github.com/sundrio/sundrio.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/sundrio/sundrio.git</developerConnection>
        <url>http://github.com/sundrio/sundrio</url>
        <tag>0.93.2</tag>
    </scm>

    <developers>
        <developer>
            <id>iocanel</id>
            <name>Ioannis Canellos</name>
            <email>iocanel@gmail.com</email>
            <url>http://iocanel.blogspot.com</url>
        </developer>
    </developers>

    <properties>
        <format.skip>false</format.skip>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>

        <maven.version>3.3.1</maven.version>
        <maven.invoker.version>2.0.11</maven.invoker.version>
        <maven-plugin-annotations.version>3.2</maven-plugin-annotations.version>

        <sun.tools.version>8</sun.tools.version>
        <validation.api.version>2.0.1.Final</validation.api.version>
        <velocity.version>1.7</velocity.version>
        <st4.version>4.3</st4.version>

        <!-- Tooling Versions -->
        <aether.version>1.0.2.v20150114</aether.version>
        <javaparser.version>2.5.1</javaparser.version>
        <swagger-annotations.version>1.5.17</swagger-annotations.version>
        <swagger-codegen.version>3.0.1</swagger-codegen.version>
        <swagger-codegen-generator.version>1.0.1</swagger-codegen-generator.version>

        <!-- Transitive Versions -->
        <commons-collections.version>3.2.2</commons-collections.version>

        <!-- Maven Plugin Versions -->
        <maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
        <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M3</maven-surefire-plugin.version>
        <maven-invoker-plugin.version>3.2.2</maven-invoker-plugin.version>
        <maven-plugin-plugin.version>3.5</maven-plugin-plugin.version>
        <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>

        <!-- Release Plugins -->
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-enforcer-plugin.version>1.3.1</maven-enforcer-plugin.version>
        <maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
        <maven-source-plugin.version>2.4</maven-source-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>

        <!-- Formatting Plugins -->
        <formatter-maven-plugin.version>2.12.2</formatter-maven-plugin.version>
        <impsort-maven-plugin.version>1.4.1</impsort-maven-plugin.version>

        <!-- Testing Version -->
        <compile-testing.version>0.5</compile-testing.version>
        <junit.version>4.13.1</junit.version>
        <hamcrest.version>1.3</hamcrest.version>
        
        <!--maven.javadoc.failOnError>false</maven.javadoc.failOnError-->
    </properties>

    <modules>
        <module>core</module>
        <module>model</module>
        <module>adapters</module>
        <module>codegen</module>
        <module>maven-plugin</module>
        <module>annotations</module>
        <module>components</module>
        <module>tests</module>
    </modules>
    
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release-plugin.version}</version>
                <configuration>
                    <preparationGoals>clean install</preparationGoals>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <!-- The option below starting causing `Unknown compilation error` as soon as SourceVersion annotations were removed
                         in favor of SourceVersion.latest().
                         According to: https://stackoverflow.com/questions/56646698/what-causes-an-unknown-compilation-problem-occurred the
                         Removing -Werror usually fixes the problem. -->

                    <!--compilerArgs>
                        <arg>-Werror</arg>
                    </compilerArgs-->
                </configuration>
            </plugin>
            <plugin>
              <groupId>net.revelc.code.formatter</groupId>
              <artifactId>formatter-maven-plugin</artifactId>
              <version>${formatter-maven-plugin.version}</version>
              <inherited>true</inherited>
              <executions>
                <execution>
                  <goals>
                    <goal>format</goal>
                  </goals>
                  <configuration>
                    <configFile>${maven.multiModuleProjectDirectory}/.code-format.xml</configFile>
                    <lineEnding>LF</lineEnding>
                    <skip>${format.skip}</skip>
                    <encoding>UTF-8</encoding>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>net.revelc.code</groupId>
              <artifactId>impsort-maven-plugin</artifactId>
              <version>${impsort-maven-plugin.version}</version>
              <inherited>true</inherited>
              <executions>
                <execution>
                  <goals>
                    <goal>sort</goal>
                  </goals>
                  <configuration>
                    <groups>java.,javax.,org.,com.</groups>
                    <staticGroups>*</staticGroups>
                    <skip>${format.skip}</skip>
                    <removeUnused>true</removeUnused>
                  </configuration>
                </execution>
              </executions>
           </plugin>     
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${validation.api.version}</version>
            </dependency>
            
            <dependency>
                <groupId>org.apache.velocity</groupId>
                <artifactId>velocity</artifactId>
                <version>${velocity.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-collections</groupId>
                <artifactId>commons-collections</artifactId>
                <version>${commons-collections.version}</version>
            </dependency>

            <dependency>
                <groupId>com.github.javaparser</groupId>
                <artifactId>javaparser-core</artifactId>
                <version>${javaparser.version}</version>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>normal</id>
        </profile>
        <profile>
          <id>release</id>
          <properties>
            <skipITs>true</skipITs>
            <format.skip>true</format.skip>
          </properties>
          <build>
            <plugins>
              <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>
                    <configuration>
                      <!-- This is necessary for gpg to not try to use the pinentry programs -->
                      <gpgArguments>
                        <arg>--pinentry-mode</arg>
                        <arg>loopback</arg>
                      </gpgArguments>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                  <execution>
                    <id>enforce-no-snapshots</id>
                    <goals>
                      <goal>enforce</goal>
                    </goals>
                    <configuration>
                      <rules>
                        <requireReleaseDeps>
                          <message>No Snapshots Allowed!</message>
                        </requireReleaseDeps>
                      </rules>
                      <fail>false</fail>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                  <includeDependencySources>${javadoc.include.deps}</includeDependencySources>
                  <dependencySourceIncludes>
                    <dependencySourceInclude>${javadoc.source.includes}</dependencySourceInclude>
                  </dependencySourceIncludes>
                  <excludePackageNames>${javadoc.package.excludes}</excludePackageNames>
                </configuration>
                <executions>
                  <execution>
                    <id>attach-javadocs</id>
                    <goals>
                      <goal>jar</goal>
                    </goals>
                    <configuration>
                      <additionalparam>${javadoc.opts}</additionalparam>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                  <execution>
                    <id>attach-sources</id>
                    <goals>
                      <goal>jar</goal>
                    </goals>
                  </execution>
                </executions>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release-plugin.version}</version>
                <configuration>
                  <autoVersionSubmodules>true</autoVersionSubmodules>
                  <tagNameFormat>@{project.version}</tagNameFormat>
                  <pushChanges>false</pushChanges>
                  <localCheckout>true</localCheckout>
                  <remoteTagging>false</remoteTagging>
                  <arguments>-DskipTests=true</arguments>
                </configuration>
              </plugin>
              <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-staging-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                  <serverId>oss-sonatype-staging</serverId>
                  <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                  <autoReleaseAfterClose>true</autoReleaseAfterClose>
                  <stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
                </configuration>
              </plugin>
            </plugins>
          </build>
        </profile>
        <profile>
             <id>jdk9</id>
             <activation>
                 <jdk>[1,1.9)</jdk>
             </activation>
             <dependencyManagement>
                 <dependencies>
                     <dependency>
                         <groupId>com.sun</groupId>
                         <artifactId>tools</artifactId>
                         <version>${sun.tools.version}</version>
                         <optional>true</optional>
                     </dependency>
                   <dependency>
                     <groupId>com.google.testing.compile</groupId>
                     <artifactId>compile-testing</artifactId>
                     <version>${compile-testing.version}</version>
                     <scope>test</scope>
                   </dependency>
                 </dependencies>
             </dependencyManagement>
        </profile>
        <profile>
             <id>jdk9+</id>
             <activation>
                 <jdk>[1.9,)</jdk>
             </activation>
             <dependencyManagement>
                 <dependencies>
                   <dependency>
                     <groupId>com.google.testing.compile</groupId>
                     <artifactId>compile-testing</artifactId>
                     <version>${compile-testing.version}</version>
                     <scope>test</scope>
                     <exclusions>
                       <exclusion>
                         <groupId>com.sun</groupId>
                         <artifactId>tools</artifactId>
                       </exclusion>
                     </exclusions>
                   </dependency>
                 </dependencies>
             </dependencyManagement>
        </profile>
        <profile>
             <id>with-examples</id>
             <modules>
               <module>examples</module>
             </modules>
        </profile>
 
    </profiles>

    <distributionManagement>
        <repository>
            <id>oss-sonatype-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
            <uniqueVersion>false</uniqueVersion>
        </repository>
        <snapshotRepository>
            <id>oss-sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

</project>
