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

    <groupId>org.entur.gbfs</groupId>
    <artifactId>gbfs-validator-java-parent</artifactId>
    <version>2.0.66</version>

    <packaging>pom</packaging>

    <name>GBFS Validator Parent</name>
    <description>Aggregator POM for GBFS Validator modules</description>
    <url>https://github.com/entur/gbfs-validator-java</url>
    <organization>
        <name>Entur AS</name>
        <url>https://www.entur.org/</url>
    </organization>
    <licenses>
        <license>
            <name>EUPL-1.2 with modifications</name>
            <url>https://joinup.ec.europa.eu/software/page/eupl</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <modules>
        <module>gbfs-validator-java</module>
        <module>gbfs-validator-java-loader</module>
        <module>gbfs-validator-java-api</module>
        <module>gbfs-validator-java-cli</module>
    </modules>

    <developers>
        <developer>
            <name>Tom Erik Støwer</name>
            <email>tom.erik.stower@entur.org</email>
            <organization>Entur</organization>
            <organizationUrl>http://www.entur.org</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:ssh://git@github.com/entur/gbfs-validator-java.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/entur/gbfs-validator-java.git</developerConnection>
        <url>https://github.com/entur/gbfs-validator-java/tree/master</url>
        <tag>HEAD</tag>
    </scm>
    <properties>
        <jreleaser-maven-plugin.version>1.20.0</jreleaser-maven-plugin.version>
        <sonar-maven-plugin.version>5.2.0.4988</sonar-maven-plugin.version>
        <prettier-java.version>2.1.0</prettier-java.version>
        <prettier-maven-plugin.version>0.22</prettier-maven-plugin.version>
        <plugin.prettier.goal>write</plugin.prettier.goal>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.jreleaser</groupId>
                <artifactId>jreleaser-maven-plugin</artifactId>
                <version>${jreleaser-maven-plugin.version}</version>
                <configuration>
                    <jreleaser>
                        <signing>
                            <active>ALWAYS</active>
                            <armored>true</armored>
                        </signing>
                        <deploy>
                            <maven>
                                <mavenCentral>
                                    <sonatype>
                                        <active>RELEASE</active>
                                        <url>https://central.sonatype.com/api/v1/publisher</url>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </sonatype>
                                </mavenCentral>
                                <nexus2>
                                    <maven-central>
                                        <active>SNAPSHOT</active>
                                        <url>https://ossrh-staging-api.central.sonatype.com/service/local</url>
                                        <snapshotUrl>https://central.sonatype.com/repository/maven-snapshots</snapshotUrl>
                                        <applyMavenCentralRules>true</applyMavenCentralRules>
                                        <snapshotSupported>true</snapshotSupported>
                                        <closeRepository>true</closeRepository>
                                        <releaseRepository>true</releaseRepository>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </maven-central>
                                </nexus2>
                            </maven>
                        </deploy>
                        <release>
                            <github>
                                <skipTag>false</skipTag>
                                <skipRelease>true</skipRelease>
                            </github>
                        </release>
                    </jreleaser>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.hubspot.maven.plugins</groupId>
                <artifactId>prettier-maven-plugin</artifactId>
                <version>${prettier-maven-plugin.version}</version>
                <configuration>
                    <prettierJavaVersion>${prettier-java.version}</prettierJavaVersion>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>${plugin.prettier.goal}</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>publication</id>
            <properties>
                <altDeploymentRepository>local::default::file:./target/staging-deploy</altDeploymentRepository>
            </properties>
            <build>
                <defaultGoal>deploy</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>${sonar-maven-plugin.version}</version>
                    </plugin>
                    <plugin>
                        <groupId>com.hubspot.maven.plugins</groupId>
                        <artifactId>prettier-maven-plugin</artifactId>
                        <version>${prettier-maven-plugin.version}</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>prettierCheck</id>
            <properties>
                <!-- In the CI environment we want to validate that code is formatted -->
                <plugin.prettier.goal>check</plugin.prettier.goal>
            </properties>
        </profile>
    </profiles>
</project>
