<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>io.openliberty.tools</groupId>
    <artifactId>liberty-langserver-lemminx</artifactId>
    <packaging>jar</packaging>
    <version>2.4</version>

    <name>lemminx-liberty</name>
    <description>The Liberty LemMinX Language Server provides language server features for Liberty server configuration files through any of the supported client IDEs.</description>
    <url>https://github.com/OpenLiberty/liberty-language-server/tree/main/lemminx-liberty</url>

    <licenses>
        <license>
            <name>Eclipse Public License - v 2.0</name>
            <url>https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Cheryl King</name>
            <email>developers@openliberty.io</email>
            <organization>Open Liberty</organization>
            <url>https://github.com/OpenLiberty</url>
        </developer>
    </developers>

    <properties>
        <lemminx.version>0.26.1</lemminx.version>
    </properties>

    <scm>
        <connection>scm:git:git@github.com:OpenLiberty/liberty-language-server.git</connection>
        <developerConnection>scm:git:git@github.com:OpenLiberty/liberty-language-server.git</developerConnection>
        <url>git@github.com:OpenLiberty/liberty-language-server.git</url>
        <tag>lemminx-liberty-2.4</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>maven-central-snapshots</id>
            <name>Maven Central Snapshot Repository</name>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>maven-central-releases</id>
            <name>Maven Central Release Repository</name>
            <url>https://central.sonatype.com/api/v1/publisher</url>
        </repository>
    </distributionManagement>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.basedir}/..</directory>
                <includes>
                    <include>NOTICES</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>about.html</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/SIG-*</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                                    <resources>
                                        <resource>.html</resource>
                                        <resource>META-INF/NOTICE</resource>
                                        <resource>META-INF/NOTICE.txt</resource>
                                        <resource>META-INF/NOTICE.md</resource>
                                        <resource>META-INF/LICENSE.txt</resource>
                                        <resource>META-INF/LICENSE.md</resource>
                                     </resources>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <setupIncludes>**/setup/pom.xml</setupIncludes>
                    <goals>
                        <goal>install</goal>
                    </goals>
                    <projectsDirectory>src/it</projectsDirectory>
                    <pomExcludes>
                        <pomExclude>all-locales-schema-and-features-gen-ol-it/pom.xml</pomExclude>
                    </pomExcludes>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <streamLogs>true</streamLogs>
                    <properties>
                        <lemminx.version>${lemminx.version}</lemminx.version>
                    </properties>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>install</goal>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.0.0-M6</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <tagNameFormat>lemminx-liberty-${project.version}</tagNameFormat>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>sonatype-oss-release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.11.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>5.12.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.openliberty.tools</groupId>
            <artifactId>ci.common</artifactId>
            <version>1.8.37</version>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.6.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.6.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>5.6.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.lemminx</groupId>
            <artifactId>org.eclipse.lemminx</artifactId>
            <version>${lemminx.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.lemminx</groupId>
            <artifactId>org.eclipse.lemminx</artifactId>
            <version>${lemminx.version}</version>
            <scope>test</scope>
            <classifier>tests</classifier>
            <type>test-jar</type>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>lemminx-releases</id>
            <url>https://repo.eclipse.org/content/repositories/lemminx-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
        <repository>
            <id>lemminx-snapshots</id>
            <url>https://repo.eclipse.org/content/repositories/lemminx-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
       <!-- Configure Sonatype OSS Maven snapshots repository -->
            <repository>
                <id>sonatype-nexus-snapshots</id>
                <name>Sonatype Nexus Snapshots</name>
                <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </repository>
    </repositories>

    <profiles>
        <profile>
            <id>sonatype-oss-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.8.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>maven-central-releases</publishingServerId>
                            <deploymentName>${project.artifactId}</deploymentName>
                        </configuration>
                    </plugin>
                    <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-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <configuration>
                            <failOnError>false</failOnError>
                        </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.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
