<!--

    Copyright (C) 2006-2019 INRIA and contributors

    Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt).
    You as the user are entitled to choose the terms under which to adopt Spoon.

-->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-pom</artifactId>
    <packaging>pom</packaging>
    <version>10.4.3-beta-4</version>
    <name>Spoon POM</name>
    <description>Common Maven config for Spoon modules</description>
    <url>http://spoon.gforge.inria.fr/</url>
    <inceptionYear>2007</inceptionYear>

    <modules>
        <module>../spoon-javadoc</module>
        <module>..</module>
    </modules>

    <properties>
        <maven.compiler.release>11</maven.compiler.release>
        <runtime.log>target/velocity.log</runtime.log>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.outputTimestamp>1698542474</project.build.outputTimestamp>
    </properties>

    <dependencies>

        <!-- we all depend on Junit with scope=test -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.6.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.10.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>5.10.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.10.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>5.6.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <organization>
        <name>Inria</name>
        <url>http://www.inria.fr</url>
    </organization>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/INRIA/spoon/issues</url>
    </issueManagement>

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

    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>ow2.org-snapshot</id>
            <name>Maven Repository for Spoon Snapshots</name>
            <url>https://repository.ow2.org/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
        <site>
            <id>gforge.inria.fr-site</id>
            <name>inria</name>
            <url>scp://scm.gforge.inria.fr/home/groups/spoon/htdocs/mvnsites</url>
        </site>
    </distributionManagement>

    <build>
        <defaultGoal>clean install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- "If you want to use a basic plain old Java classpath, [...] set useManifestOnlyJar=false and useSystemClassLoader=true".
                    https://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html -->
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.src.version}</source>
                    <target>${java.src.version}</target>
                    <testSource>${java.test.version}</testSource>
                    <testTarget>${java.test.version}</testTarget>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint:deprecation,unchecked</arg>
                        <!-- always generate class files for package-info -->
                        <arg>-Xpkginfo:always</arg>
                    </compilerArgs>
                    <!-- incremental compilation is broken in maven, see https://issues.apache.org/jira/browse/MCOMPILER-205  -->
                    <!-- useIncrementalCompilation=false actually means that we won't recompile everything each time -->
                    <!-- it's not a joke, test by yourself :-) -->
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                    <annotationProcessorPaths>
                        <annotationProcessorPath>
                            <groupId>org.kohsuke.metainf-services</groupId>
                            <artifactId>metainf-services</artifactId>
                            <version>1.11</version>
                        </annotationProcessorPath>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
                  <plugin>
                    <!-- see https://github.com/castor-software/depclean -->
                    <groupId>se.kth.castor</groupId>
                    <artifactId>depclean-maven-plugin</artifactId>
                    <version>2.0.6</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>depclean</goal>
                            </goals>
                            <configuration>
                                <!-- the build should fail if there are unused direct dependencies -->
                                <failIfUnusedDirect>true</failIfUnusedDirect>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
        </plugins>


        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.3.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.11.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.6.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.4.5</version>
                </plugin>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>

                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>4.3</version>
                    <configuration>
                        <licenseSets>
                            <licenseSet>
                                <header>LICENSE-short.txt</header>
                                <includes>
                                    <include>src/main/java/**</include>
                                    <!-- We also want to check the license in templates to generate files with the proper header -->
                                    <include>src/test/java/spoon/generating/clone/*</include>
                                </includes>
                            </licenseSet>
                        </licenseSets>
                        <excludes>
                            <!--  excluding the code coming from Javaparser -->
                            <exclude>src/main/java/spoon/javadoc/internal/*</exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.11</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
            </extension>
        </extensions>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
            </plugin>
            <plugin>
                <!-- Warning the configuration here is used in "mvn site", not in "mvn javadoc:javadoc" -->
                <!-- There is another block maven-javadoc-plugin below -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- see https://stackoverflow.com/a/57430117 -->
                    <doclint>none</doclint>
                    <detectJavaApiLink>false</detectJavaApiLink>
                    <!-- ref: https://github.com/INRIA/spoon/pull/4253 -->
                    <additionalJOption>-notimestamp</additionalJOption>
                </configuration>
                <reportSets>
                    <reportSet>
                        <id>html</id>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>coveralls</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                            <execution>
                                <!-- reference:
                                * https://www.jacoco.org/jacoco/trunk/doc/check-mojo.html
                                * https://stackoverflow.com/questions/41891739/how-to-fail-a-maven-build-if-junit-coverage-falls-below-certain-threshold
                                -->
                                <id>check-coverage</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <rule implementation="org.jacoco.maven.RuleConfiguration">
                                            <element>CLASS</element>
                                            <excludes>
                                                <!-- we exclude the GUI classes, because we don't have Swing GUI tests in CI -->
                                                <exclude>spoon.support.gui.*</exclude>
                                                <!-- we exclude the generated inner classes of ReplacementVisitor -->
                                                <exclude>spoon.support.visitor.replace.ReplacementVisitor.*</exclude>
                                            </excludes>
                                            <limits>
                                                <limit implementation="org.jacoco.report.check.Limit">
                                                    <counter>LINE</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>0.1</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.eluder.coveralls</groupId>
                        <artifactId>coveralls-maven-plugin</artifactId>
                        <version>4.3.0</version>
                        <dependencies>
                            <dependency>
                                <groupId>javax.xml.bind</groupId>
                                <artifactId>jaxb-api</artifactId>
                                <version>2.3.1</version>
                            </dependency>
                        </dependencies>
                    </plugin>


                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <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>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.wagon</groupId>
                                <artifactId>wagon-ssh</artifactId>
                                <version>3.5.3</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <!-- Warning: there is another block maven-javadoc-plugin above -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</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-deploy-plugin</artifactId>
                        <version>3.1.1</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jreleaser</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>3.1.1</version>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.11</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <licenses>
        <license>
            <name>CeCILL-C</name>
            <comments>French equivalent to LGPL</comments>
            <url>https://cecill.info/licences/Licence_CeCILL-C_V1-en.txt</url>
            <distribution>repo</distribution>
        </license>
        <license>
            <name>MIT</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <!-- the list is maintained in the README https://github.com/INRIA/spoon/blob/master/README.md -->
        <!-- We list all current integrators here for mavencentral-->
        <developer>
            <id>slarse</id>
            <name>Simon Larsén</name>
        </developer>
        <developer>
            <id>monperrus</id>
            <name>Martin Monperrus</name>
        </developer>
        <developer>
            <id>nharrand</id>
            <name>Nicolas Harrand</name>
        </developer>
        <developer>
            <id>martinwitt</id>
            <name>Martin Wittlinger</name>
        </developer>
        <developer>
            <id>sirywell</id>
            <name>Hannes Greule</name>
        </developer>
        <developer>
            <id>I-Al-Istannen</id>
            <name>I-Al-Istannen</name>
        </developer>
    </developers>
</project>
