<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Nuiton Config :: Example
  %%
  Copyright (C) 2016 - 2026 Code Lutin
  %%
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Lesser Public License for more details.
  
  You should have received a copy of the GNU General Lesser Public
  License along with this program.  If not, see
  <http://www.gnu.org/licenses/lgpl-3.0.html>.
  #L%
  -->

<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>org.nuiton</groupId>
    <artifactId>nuiton-config-project</artifactId>
    <version>3.8-SNAPSHOT</version>
  </parent>

  <artifactId>nuiton-config-example</artifactId>

  <name>Nuiton Config :: Example</name>
  <description>Nuiton Config Example</description>
  <inceptionYear>2016</inceptionYear>

  <properties>

    <!-- Post Release configuration -->
    <skipPostRelease>true</skipPostRelease>

    <redmine.releaseFiles>
      ${project.build.directory}/${project.build.finalName}-full.zip
    </redmine.releaseFiles>

  </properties>

  <dependencies>

    <dependency>
      <groupId>org.nuiton</groupId>
      <artifactId>nuiton-config</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>

  </dependencies>

  <build>

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <useUniqueVersions>false</useUniqueVersions>
                <addClasspath>false</addClasspath>
                <classpathPrefix />
                <mainClass>org.nuiton.config.example.NuitonConfigExample</mainClass>
              </manifest>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>

      <plugin>
        <groupId>org.nuiton</groupId>
        <artifactId>nuiton-config-maven-plugin</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.nuiton</groupId>
        <artifactId>nuiton-config-maven-plugin</artifactId>
        <version>${project.version}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>

    <profile>
      <id>reporting</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>Copy files to site</id>
                <phase>pre-site</phase>
                <configuration>
                  <target>
                    <copy todir="${project.reporting.outputDirectory}/model" failonerror="true" overwrite="true">
                      <fileset dir="src/main/config">
                        <include name="*.ini" />
                        <include name="*.toml" />
                        <include name="*.yaml" />
                      </fileset>
                    </copy>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    </profile>

    <profile>
      <id>assembly-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <defaultGoal>package</defaultGoal>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>create-assemblies</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <attach>true</attach>
              <descriptorRefs>
                <descriptorRef>full</descriptorRef>
              </descriptorRefs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>
</project>
