<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.github.sviperll</groupId>
    <artifactId>sviperll-maven-parent-6</artifactId>
    <name>sviperll-maven-parent-6</name>
    <version>3.2</version>
    <packaging>pom</packaging>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <scm>
        <connection>scm:git:git://github.com/sviperll/sviperll-maven-parent-6.git</connection>
        <developerConnection>scm:git:git@github.com:sviperll/sviperll-maven-parent-6.git</developerConnection>
        <url>https://github.com/sviperll/sviperll-maven-parent-6</url>
        <tag>sviperll-maven-parent-6-3.2</tag>
    </scm>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.1</version>
            </plugin>
        </plugins>
    </reporting>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>${project.build.sourceEncoding}</encoding>

                    <!-- Compiler plugin uses Java compiler API since version 3.0.
                         Usage of compiler API is much better than forking javac executable.
                         Compiler API is much faster as it's run in same process.
                         And most importatly ALL compiler messages are printed by maven.
                         When standalone javac executable is run maven parses it's output and
                         some messages are lost in the process!!! -->
                    <forceJavacCompilerUse>false</forceJavacCompilerUse>
                    <useIncrementalCompilation>true</useIncrementalCompilation>
                    <fork>false</fork>


                    <!-- Verbose makes java compiler to produce detailed log of it's actions -->
                    <verbose>false</verbose>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <!--
                          This is important.
                          If your project contains annotation processor than it must be compiled without
                          services file otherwise Java compiler fail silently because
                          it can't find annotation processor stated in this file because
                          annotation processor is not compiled yet!
                          -->
                        <id>remove-annotation-processor-services-meta-info</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${project.build.outputDirectory}</directory>
                                    <includes>
                                        <include>META-INF/services/javax.annotation.processing.Processor</include>
                                    </includes>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
                <executions>
                    <execution>
                        <!--
                          Services file for annotation processors must be copied to output directory
                          when all java files are compiled (including annotation processors)
                          -->
                        <id>copy-annotation-processor-services-meta-info</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <includes>
                                        <include>META-INF/services/javax.annotation.processing.Processor</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <!-- 2.2 ,2.3 and 2.4 doesn't work with git -->
                <version>2.5.1</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.3.1</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <DependencyConvergence />
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.8</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.4</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.doxia</groupId>
                        <artifactId>doxia-module-markdown</artifactId>
                        <version>1.6</version>
                    </dependency>
                    <dependency>
                        <groupId>net.trajano.wagon</groupId>
                        <artifactId>wagon-git</artifactId>
                        <version>2.0.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <!--
                      Do not copy annotation processor services file. It's done by
                      another (copy-annotation-processor-services-meta-info)
                      execution of resources plugin
                      -->
                    <exclude>META-INF/services/javax.annotation.processing.Processor</exclude>
                </excludes>
            </resource>
        </resources>
    </build>
    <profiles>
        <profile>
            <!--
                Set bootclasspath and use standalone javac executable to compile java
                when JDK6_HOME environment variable is set.

                It is recomended to compile without JDK6_HOME variable during development and
                to compile with JDK6_HOME only when all errors and warnings are cleared.

                When you compile without JDK6_HOME maven uses Java compiler API to compile project.
                When you compile with JDK6_HOME maven always forks javac executable.

                Forking javac is slow. Another drawback is error messages. When compiler API is used
                all compiler messages are passed back to maven and correctly printed.
                When javac executable is used maven has to process and parse it's output, this
                process is prone to errors and causes several warnings not to be outputed...
            -->
            <id>bootclasspath-specification</id>
            <activation>
                <property>
                    <name>env.JDK6_HOME</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration combine.self="append">
                            <fork>true</fork>
                            <compilerArgs>
                                <arg>-bootclasspath</arg>
                                <arg>${env.JDK6_HOME}/jre/lib/rt.jar</arg>
                            </compilerArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
