<?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.0.2-SNAPSHOT</version>
    <relativePath>../</relativePath>
  </parent>

    <artifactId>sorald-api</artifactId>
    <version>0.0.2</version>
    <packaging>jar</packaging>
    <name>Sorald-API</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>slarse</id>
            <name>Simon Larsén</name>
            <email>slarse@kth.se</email>
            <organization>KTH Royal Institute of Technology</organization>
            <organizationUrl>https://www.kth.se</organizationUrl>
        </developer>
        <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>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>org.sonarsource.sonarlint.core</groupId>
            <artifactId>sonarlint-core</artifactId>
            <version>8.6.0.47852</version>
        </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.6.3</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-deploy-plugin</artifactId>
                <version>2.8.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.13.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.4.1</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.4.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>2.22.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
            </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.7</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.23.0</version>
                <configuration>
                    <java>
                        <includes>
                            <include>src/main/java/**/*.java</include>
                            <include>src/test/java/**/*.java</include>
                        </includes>
                        <googleJavaFormat>
                            <version>1.9</version>
                            <style>AOSP</style>
                        </googleJavaFormat>
                    </java>
                </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>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <configuration>
                            <!-- Prevent gpg from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.13</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </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>
