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

  Copyright 2025 Tirasa
 
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is 
  furnished to do so, subject to the following conditions:
 
  The above copyright notice and this permission notice shall be included in 
  all copies or substantial portions of the Software.
 
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
  THE SOFTWARE.

-->
<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>

  <name>Apache Groovy Security Sandbox</name>
  <description>Fork of Jenkins' Script Security Plugin for usage outside Jenkins itself</description>
  <groupId>net.tirasa</groupId>
  <artifactId>groovy-security-sandbox</artifactId>
  <version>1.0.0</version>
  <packaging>jar</packaging>

  <url>https://github.com/Tirasa/groovy-security-sandbox</url>
  <inceptionYear>2025</inceptionYear>

  <licenses>
    <license>
      <name>MIT license</name>
      <url>https://opensource.org/license/mit</url>
      <distribution>repo</distribution>    
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:Tirasa/groovy-security-sandbox.git</connection>
    <url>scm:git:git@github.com:Tirasa/groovy-security-sandbox.git</url>
    <developerConnection>scm:git:git@github.com:Tirasa/groovy-security-sandbox.git</developerConnection>
    <tag>groovy-security-sandbox-1.0.0</tag>
  </scm>

  <issueManagement>
    <system>Github Issue</system>
    <url>https://github.com/Tirasa/groovy-security-sandbox/issues</url>
  </issueManagement>

  <ciManagement>
    <system>GitHub Workflow</system>
    <url>https://github.com/Tirasa/groovy-security-sandbox/actions</url>
  </ciManagement>

  <distributionManagement>
    <snapshotRepository>
      <id>central-portal-snapshots</id>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </snapshotRepository>
    <repository>
      <id>central-portal</id>
      <url>https://central.sonatype.com</url>
    </repository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>central-portal-snapshots</id>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <developers>
    <developer>
      <id>ilgrosso</id>
      <email>ilgrosso@apache.org</email>
      <name>Francesco Chicchiriccò</name>
      <organization>Tirasa</organization>
      <organizationUrl>https://www.tirasa.net/</organizationUrl>
      <url>https://about.me/ilgrosso/</url>
    </developer>
  </developers>

  <properties>
    <groovy.version>4.0.28</groovy.version>

    <targetJdk>8</targetJdk>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>${groovy.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy-sql</artifactId>
      <version>${groovy.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.18.0</version>
    </dependency>

    <dependency>
      <groupId>org.craftercms</groupId>
      <artifactId>groovy-sandbox</artifactId>
      <version>4.0.6</version>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>clean verify</defaultGoal>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.0</version>
          <configuration>
            <source>${targetJdk}</source>
            <target>${targetJdk}</target>
            <useIncrementalCompilation>false</useIncrementalCompilation>
            <showWarnings>true</showWarnings>
            <showDeprecation>true</showDeprecation>
            <compilerArgument>-Xlint:unchecked</compilerArgument>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.6.0</version>
          <configuration>
            <configLocation>src/main/resources/checkstyle.xml</configLocation>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <useReleaseProfile>false</useReleaseProfile>
            <arguments>${arguments} -Pcentral-portal-release</arguments>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.6.1</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>${targetJdk}</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>3.9.5</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.gaul</groupId>
        <artifactId>modernizer-maven-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <javaVersion>${targetJdk}</javaVersion>
        </configuration>
        <executions>
          <execution>
            <id>modernizer-check</id>
            <phase>verify</phase>
            <goals>
              <goal>modernizer</goal>
            </goals>
          </execution>
        </executions>
      </plugin>      

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <resourceExcludes>**/LICENSE</resourceExcludes>
        </configuration>
        <executions>
          <execution>
            <id>checkstyle-check</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.16.1</version>
        <configuration>
          <excludes>
            <exclude>nbactions.xml</exclude>
            <exclude>nb-configuration.xml</exclude>
            <exclude>**/META-INF/cxf/**</exclude>
            <exclude>**/META-INF/services/**</exclude>
            <exclude>**/META-INF/MANIFEST.MF</exclude>            
            <exclude>**/*.csv</exclude>
            <exclude>**/archetype-resources/**</exclude>
            <exclude>**/AdminLTE*/**</exclude>
            <exclude>**/goal.txt</exclude>
            <exclude>**/rat.txt</exclude>
            <exclude>**/build-copy-javadoc-files.xml</exclude>
            <exclude>**/maven-eclipse.xml</exclude>
            <exclude>**/*.iml</exclude>
            <exclude>**/*.log</exclude>
            <exclude>**/.externalToolBuilders/**</exclude>
            <exclude>.git/**</exclude>
            <exclude>.idea/**</exclude>
            <exclude>**/.settings/**</exclude>
            <exclude>**/.*</exclude>
            <exclude>**/deb/control/conffiles</exclude>
            <exclude>**/deb/control/control</exclude>
            <exclude>**/*.lst</exclude>
            <exclude>**/*.json</exclude>
            <exclude>**/target/**</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <id>rat-check</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Put LICENSE files in all artifacts and javadocs -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>copy-artifact-legal-files</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/classes/META-INF</outputDirectory>
              <resources>
                <resource>
                  <includes>
                    <include>LICENSE</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-javadoc-legal-files</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/apidocs/META-INF</outputDirectory>
              <resources>
                <resource>
                  <includes>
                    <include>LICENSE</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <mavenExecutorId>forked-path</mavenExecutorId>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <tagNameFormat>groovy-security-sandbox-@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <directory>.</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>LICENSE</include>
        </includes>
      </resource>
    </resources>
  </build>

  <profiles>
    <profile>
      <id>central-portal-release</id>

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

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.11.3</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>          
          </plugin>

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

          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.8.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central-portal</publishingServerId>
              <waitUntil>uploaded</waitUntil>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>    
  </profiles>
</project>
