<?xml version="1.0" encoding="UTF-8"?>
<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>se.kth.castor</groupId>
    <artifactId>sorald-parent</artifactId>
    <version>0.8.2</version>
  </parent>

    <artifactId>sorald</artifactId>
    <packaging>maven-plugin</packaging>

    <name>Sorald</name>
    <description>An automatic repair system for static code analysis warnings from Sonar Java.</description>
    <url>https://github.com/SpoonLabs/sorald</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>khaes-kth</id>
            <name>Khashayar Etemadi</name>
            <email>khaes@kth.se</email>
            <organization>KTH Royal Institute of Technology</organization>
            <organizationUrl>https://www.kth.se</organizationUrl>
        </developer>
        <developer>
            <id>algomaster99</id>
            <name>Aman Sharma</name>
            <email>amansha@kth.se</email>
            <url>https://algomaster99.github.io/</url>
            <organization>KTH Royal Institute of Technology</organization>
            <organizationUrl>https://www.kth.se</organizationUrl>
        </developer>
        <developer>
            <id>fermadeiral</id>
            <name>Fernanda Madeiral</name>
            <email>fer.madeiral@gmail.com</email>
            <organization>KTH Royal Institute of Technology</organization>
            <organizationUrl>https://www.kth.se</organizationUrl>
        </developer>
    </developers>

    <dependencies>
        <dependency>
            <groupId>se.kth.castor</groupId>
            <artifactId>sorald-api</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>org.sonarsource.sonarlint.core</groupId>
            <artifactId>sonarlint-core</artifactId>
            <version>8.15.0.65216</version>
        </dependency>
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
            <version>${picocli.version}</version>
        </dependency>
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli-codegen</artifactId>
            <version>${picocli.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20230227</version>
        </dependency>
        <!-- maven-plugin dependencies -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.8.1</version>
        </dependency>

        <!-- Integration tests -->
        <!-- see https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html#_grouping_test_cases -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.24.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.9.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.soebes.itf.jupiter.extension</groupId>
            <artifactId>itf-assertj</artifactId>
            <version>0.12.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.soebes.itf.jupiter.extension</groupId>
            <artifactId>itf-jupiter-extension</artifactId>
            <version>0.12.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <properties>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <picocli.version>4.7.2</picocli.version>
        <sonar.projectKey>SpoonLabs_sorald</sonar.projectKey>
        <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
        <sonar.organization>spoonlabs</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.0.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>2.0.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>perform</goal>
                        </goals>
                        <configuration>
                            <pomFileName>pom.xml</pomFileName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- creates the build number (git commit hash) that is later attached to the manifest -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals><goal>create</goal></goals>
                    </execution>
                </executions>
                <configuration>
                    <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                    <shortRevisionLength>8</shortRevisionLength>
                    <attach>true</attach>
                    <addOutputDirectoryToResources>true</addOutputDirectoryToResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>sorald.Main</mainClass>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Implementation-SCM-Revision>${buildNumber}</Implementation-SCM-Revision>
                            <Multi-Release>true</Multi-Release>
                        </manifestEntries>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                        <!-- descriptorRef>project</descriptorRef -->
                    </descriptorRefs>
                    <!-- descriptor>src/main/assembly/project.xml</descriptor -->
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id><!-- this is used for inheritance merges -->
                        <phase>package</phase><!-- append to the packaging phase. -->
                        <goals>
                            <goal>single</goal><!-- goals == mojos -->
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0</version>
                <!-- Used to run ONLY integration tests and skip the unit tests -->
                <!-- Run it like so: `mvn verify -DskipUnitTests` -->
                <configuration>
                    <skipTests>${skipUnitTests}</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
            </plugin>
            <!-- To make repair goal work on mvn3.6.3 -->
            <!-- See https://stackoverflow.com/questions/10188534/custom-type-converter-for-mojo-configuration -->
            <plugin>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-component-metadata</artifactId>
                <version>2.1.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-metadata</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- adapted from https://www.jacoco.org/jacoco/trunk/doc/examples/build/pom.xml -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.9</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>sorald/annotations/**/*.class</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- adapted from https://github.com/diffplug/spotless/blob/main/plugin-maven/README.md -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.35.0</version>
                <configuration>
                    <java>
                        <includes>
                            <include>src/main/java/**/*.java</include>
                            <include>src/test/java/**/*.java</include>
                        </includes>
                        <googleJavaFormat>
                            <version>1.15.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>
                    </java>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.soebes.itf.jupiter.extension</groupId>
                <artifactId>itf-maven-plugin</artifactId>
                <version>0.11.0</version>
                <executions>
                    <execution>
                        <id>installing</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>install</goal>
                            <goal>resources-its</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skipTests>${skipIntegrationTests}</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>spoonSnapshot</id>
            <repositories>
                <repository>
                    <id>ow2.org-snapshot</id>
                    <name>Maven Repository for Spoon Snapshots</name>
                    <url>https://repository.ow2.org/nexus/content/repositories/snapshots/</url>
                    <snapshots><enabled>true</enabled></snapshots>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:https://github.com/SpoonLabs/sorald.git</connection>
        <developerConnection>scm:git:ssh://github.com/SpoonLabs/sorald.git</developerConnection>
        <url>https://github.com/SpoonLabs/sorald</url>
        <tag>HEAD</tag>
    </scm>

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