<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>net.sulea.cristian</groupId>
    <artifactId>maven-project-parent</artifactId>
<!--     <relativePath>../maven-project-parent/pom.xml</relativePath> -->
    <version>2.5</version>
  </parent>

  <artifactId>maven-project-parent-java</artifactId>
  <packaging>pom</packaging>


  <version>2.6</version>


  <name>Maven Project Parent for Java</name>
  <description>The Maven Project Parent for Java POM provides all the common settings for all the Maven/Java projects.</description>
  <url>http://cristian.sulea.net/projects/maven-project-parent-java/</url>

  <inceptionYear>2016</inceptionYear>

  <developers>
    <developer>
      <id>cristian.sulea</id>
      <name>Cristian Sulea</name>
      <email>cristian.sulea.79@gmail.com</email>
      <url>http://cristian.sulea.net</url>
      <timezone>Europe/Bucharest</timezone>
      <roles>
        <role>owner</role>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <organization>cristian.sulea.net</organization>
      <organizationUrl>http://cristian.sulea.net</organizationUrl>
    </developer>
  </developers>


  <scm>
    <connection>scm:git:git@github.com:cristian-sulea/maven-project-parent-java.git</connection>
    <developerConnection>scm:git:git@github.com:cristian-sulea/maven-project-parent-java.git</developerConnection>
    <url>https://github.com/cristian-sulea/maven-project-parent-java</url>
  </scm>


  <properties>

    <java.version>1.8</java.version>

    <skip.plugin.source>false</skip.plugin.source>
    <skip.plugin.surefire>false</skip.plugin.surefire>
    <skip.plugin.surefire.report>false</skip.plugin.surefire.report>
    <skip.plugin.javadoc>false</skip.plugin.javadoc>
    <skip.plugin.checkstyle>false</skip.plugin.checkstyle>
    <skip.plugin.checkstyle.report>false</skip.plugin.checkstyle.report>
    <skip.plugin.findbugs>false</skip.plugin.findbugs>
    <skip.plugin.findbugs.report>false</skip.plugin.findbugs.report>
    <skip.plugin.pmd>false</skip.plugin.pmd>
    <skip.plugin.pmd.report>false</skip.plugin.pmd.report>

    <version.plugin.source>2.2.1</version.plugin.source>
    <version.plugin.compiler>3.5.1</version.plugin.compiler>
    <version.plugin.surefire>2.19.1</version.plugin.surefire>
    <version.plugin.javadoc>2.10.3</version.plugin.javadoc>
    <version.plugin.checkstyle>2.17</version.plugin.checkstyle>
    <version.plugin.checkstyle.library>7.7</version.plugin.checkstyle.library>
    <version.plugin.checkstyle.rules>2.4</version.plugin.checkstyle.rules>
    <version.plugin.findbugs>3.0.1</version.plugin.findbugs>
    <version.plugin.pmd>3.6</version.plugin.pmd>

    <version.plugin.surefire.report>2.19.1</version.plugin.surefire.report>
    <version.plugin.jxr>2.5</version.plugin.jxr>

    <version.plugin.assembly>2.4</version.plugin.assembly>
    <version.plugin.assembly.descriptors>2.4</version.plugin.assembly.descriptors>

    <version.plugin.resources>3.0.2</version.plugin.resources>

    <version.dependency.commons-logging>1.1.1</version.dependency.commons-logging>
    <version.dependency.junit>4.11</version.dependency.junit>

  </properties>


  <dependencies>

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>${version.dependency.commons-logging}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${version.dependency.junit}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>


  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${version.plugin.source}</version>
        <configuration>
          <skipSource>${skip.plugin.source}</skipSource>
          <archive>
            <manifestEntries>
              <Built-By>${text.archive.manifest.built-by}</Built-By>
            </manifestEntries>
          </archive>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jar-no-fork</goal>
              <goal>test-jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${version.plugin.compiler}</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.plugin.surefire}</version>
        <configuration>
          <skip>${skip.plugin.surefire}</skip>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${version.plugin.javadoc}</version>
        <configuration>
          <skip>${skip.plugin.javadoc}</skip>
          <additionalparam>-Xdoclint:none</additionalparam>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${version.plugin.checkstyle}</version>
        <configuration>
          <skip>${skip.plugin.checkstyle}</skip>
          <configLocation>checkstyle.xml</configLocation>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${version.plugin.checkstyle.library}</version>
          </dependency>
          <dependency>
            <groupId>net.sulea.cristian</groupId>
            <artifactId>maven-checkstyle-rules</artifactId>
            <version>${version.plugin.checkstyle.rules}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
              <!-- <goal>checkstyle</goal> -->
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>${version.plugin.findbugs}</version>
        <configuration>
          <skip>${skip.plugin.findbugs}</skip>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>${version.plugin.pmd}</version>
        <configuration>
          <skip>${skip.plugin.pmd}</skip>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>


  <reporting>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>${version.plugin.surefire.report}</version>
        <configuration>
          <skipSurefireReport>${skip.plugin.surefire.report}</skipSurefireReport>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${version.plugin.checkstyle}</version>
        <configuration>
          <skip>${skip.plugin.checkstyle.report}</skip>
          <configLocation>checkstyle.xml</configLocation>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>${version.plugin.findbugs}</version>
        <configuration>
          <skip>${skip.plugin.findbugs.report}</skip>
          <!-- <skipEmptyReport>false</skipEmptyReport> -->
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>${version.plugin.pmd}</version>
        <configuration>
          <skip>${skip.plugin.pmd}</skip>
          <!-- <skipEmptyReport>false</skipEmptyReport> -->
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>pmd</report>
              <report>cpd</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>${version.plugin.jxr}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>jxr</report>
              <report>test-jxr</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

    </plugins>
  </reporting>


  <profiles>

    <profile>

      <id>dist</id>

      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>mkdir-extra-resources</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <mkdir dir="target/extra-resources" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>${version.plugin.resources}</version>
            <executions>
              <execution>
                <id>copy-resources</id>
                <phase>package</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>target/extra-resources</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/bin</directory>
                      <filtering>true</filtering>
                    </resource>
                  </resources>
                  <nonFilteredFileExtensions>
                    <nonFilteredFileExtension>exe</nonFilteredFileExtension>
                  </nonFilteredFileExtensions>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${version.plugin.assembly}</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>net.sulea.cristian</groupId>
                <artifactId>maven-assembly-descriptors</artifactId>
                <version>${version.plugin.assembly.descriptors}</version>
              </dependency>
            </dependencies>
            <configuration>
              <descriptorRefs>
                <descriptorRef>dist-bin</descriptorRef>
                <descriptorRef>dist-src</descriptorRef>
              </descriptorRefs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>

      <id>dist-obfuscated</id>

      <build>
        <plugins>
          <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <version>2.0.11</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>proguard</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <libs>
                <lib>${java.home}/lib/rt.jar</lib>
                <lib>${java.home}/lib/jce.jar</lib>
              </libs>
              <proguardInclude>../maven-project-parent-java/src/main/resources/proguard.conf</proguardInclude>
              <addMavenDescriptor>true</addMavenDescriptor>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>mkdir-extra-resources</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <mkdir dir="target/extra-resources" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>${version.plugin.resources}</version>
            <executions>
              <execution>
                <id>copy-resources</id>
                <phase>package</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>target/extra-resources</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/bin</directory>
                      <filtering>true</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${version.plugin.assembly}</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>net.sulea.cristian</groupId>
                <artifactId>maven-assembly-descriptors</artifactId>
                <version>${version.plugin.assembly.descriptors}</version>
              </dependency>
            </dependencies>
            <configuration>
              <descriptorRefs>
                <descriptorRef>dist-bin</descriptorRef>
                <descriptorRef>dist-src</descriptorRef>
              </descriptorRefs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>

      <id>launch4j</id>

      <build>
        <plugins>
          <plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <version>1.7.21</version>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>launch4j</goal>
                </goals>
                <configuration>
                  <dontWrapJar>true</dontWrapJar>
                  <headerType>gui</headerType>
                  <outfile>target/extra-resources/${launch4j.fileName}.exe</outfile>
                  <icon>${launch4j.icon}</icon>
                  <singleInstance>
                    <mutexName>${launch4j.singleInstance.mutexName}</mutexName>
                    <windowTitle></windowTitle>
                  </singleInstance>
                  <classPath>
                    <mainClass>${launch4j.mainClass}</mainClass>
                    <preCp>%EXEDIR%/lib/*</preCp>
                  </classPath>
                  <jar>%EXEDIR%/lib/${project.build.finalName}.jar</jar>
                  <jre>
                    <minVersion>1.8.0</minVersion>
                    <opts>
                      <opt>-Dlaunch4j.exedir=%EXEDIR%</opt>
                    </opts>
                  </jre>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>