<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2021 the Eclipse Milo Authors
  ~
  ~ This program and the accompanying materials are made
  ~ available under the terms of the Eclipse Public License 2.0
  ~ which is available at https://www.eclipse.org/legal/epl-2.0/
  ~
  ~ SPDX-License-Identifier: EPL-2.0
  -->

<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.eclipse.milo</groupId>
    <artifactId>milo</artifactId>
    <version>0.6.6</version>
    <packaging>pom</packaging>

    <name>Eclipse Milo - OPC UA (IEC 62541)</name>
    <description>An open source implementation of OPC UA (IEC 62541).</description>
    <url>https://github.com/eclipse/milo</url>

    <scm>
        <url>https://github.com/eclipse/milo</url>
        <connection>scm:git:git://github.com/eclipse/milo.git</connection>
        <developerConnection>scm:git:git@github.com:eclipse/milo.git</developerConnection>
        <tag>v0.6.6</tag>
    </scm>

    <developers>
        <developer>
            <id>kevinherron</id>
            <name>Kevin Herron</name>
            <email>kevinherron@gmail.com</email>
        </developer>
    </developers>

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

    <modules>
        <module>build-tools</module>
        <module>milo-examples</module>
        <module>opc-ua-stack</module>
        <module>opc-ua-sdk</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <profiles>
        <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-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <configuration>
                            <failOnError>false</failOnError>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.2.0</version>
                        <extensions>false</extensions>
                        <inherited>true</inherited>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>javadoc-and-source</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-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <configuration>
                            <failOnError>false</failOnError>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <configLocation>milo/checkstyle.xml</configLocation>
                    <excludes>
                        **/org/eclipse/milo/opcua/sdk/server/namespaces/loader/*,
                        **/org/eclipse/milo/opcua/stack/core/types/structured/**,
                        **/org/eclipse/milo/opcua/stack/core/types/enumerated/**,
                        **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits.java,
                        **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits0.java,
                        **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits1.java,
                        **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnitsBase.java,
                        **/org/eclipse/milo/opcua/sdk/client/dtd/BuiltinDataTypeInfo.java,
                        **/org/eclipse/milo/opcua/sdk/client/model/nodes/objects/*,
                        **/org/eclipse/milo/opcua/sdk/client/model/nodes/variables/*,
                        **/org/eclipse/milo/opcua/sdk/client/model/types/objects/*,
                        **/org/eclipse/milo/opcua/sdk/client/model/types/variables/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/nodes/objects/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/nodes/variables/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/types/objects/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/types/variables/*,
                        **/org/eclipse/milo/opcua/stack/core/types/builtin/unsigned/*,
                        **/org/eclipse/milo/opcua/stack/core/Identifiers.java,
                        **/org/eclipse/milo/opcua/stack/core/StatusCodes.java,
                        **/org/eclipse/milo/opcua/stack/core/types/TypeInitializer.java,
                        **/org/opcfoundation/opcua/binaryschema/*
                    </excludes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>8.18</version>
                    </dependency>
                    <dependency>
                        <groupId>org.eclipse.milo</groupId>
                        <artifactId>build-tools</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>jcl-over-slf4j</artifactId>
                        <version>1.7.21</version>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-jdk14</artifactId>
                        <version>1.7.21</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <configLocation>milo/checkstyle.xml</configLocation>
                            <excludes>
                                **/org/eclipse/milo/opcua/sdk/server/namespaces/loader/*,
                                **/org/eclipse/milo/opcua/stack/core/types/structured/**,
                                **/org/eclipse/milo/opcua/stack/core/types/enumerated/**,
                                **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits.java,
                                **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits0.java,
                                **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnits1.java,
                                **/org/eclipse/milo/opcua/sdk/core/CefactEngineeringUnitsBase.java,
                                **/org/eclipse/milo/opcua/sdk/client/dtd/BuiltinDataTypeInfo.java,
                                **/org/eclipse/milo/opcua/sdk/client/model/nodes/objects/*,
                                **/org/eclipse/milo/opcua/sdk/client/model/nodes/variables/*,
                                **/org/eclipse/milo/opcua/sdk/client/model/types/objects/*,
                                **/org/eclipse/milo/opcua/sdk/client/model/types/variables/*,
                                **/org/eclipse/milo/opcua/sdk/server/model/methods/*,
                                **/org/eclipse/milo/opcua/sdk/server/model/nodes/objects/*,
                                **/org/eclipse/milo/opcua/sdk/server/model/nodes/variables/*,
                                **/org/eclipse/milo/opcua/sdk/server/model/types/objects/*,
                                **/org/eclipse/milo/opcua/sdk/server/model/types/variables/*,
                                **/org/eclipse/milo/opcua/stack/core/types/builtin/unsigned/*,
                                **/org/eclipse/milo/opcua/stack/core/Identifiers.java,
                                **/org/eclipse/milo/opcua/stack/core/StatusCodes.java,
                                **/org/eclipse/milo/opcua/stack/core/types/TypeInitializer.java,
                                **/org/opcfoundation/opcua/binaryschema/*
                            </excludes>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <failOnViolation>true</failOnViolation>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M3</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.2.5</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.2.0</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name>
                            </manifestEntries>
                            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>5.1.2</version>
                    <executions>
                        <execution>
                            <id>generate-manifest</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>manifest</goal>
                            </goals>
                            <configuration>
                                <supportedProjectTypes>
                                    <supportedProjectType>jar</supportedProjectType>
                                    <supportedProjectType>bundle</supportedProjectType>
                                </supportedProjectTypes>
                                <instructions>
                                    <Import-Package>
                                        com.sun.management.*;resolution:=optional,
                                        !javax.annotation.*,
                                        *
                                    </Import-Package>
                                </instructions>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.0-M1</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <useReleaseProfile>false</useReleaseProfile>
                        <releaseProfiles>release</releaseProfiles>
                        <goals>deploy</goals>
                        <tagNameFormat>v@{project.version}</tagNameFormat>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M4</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <configLocation>milo/checkstyle.xml</configLocation>
                    <excludes>
                        **/org/eclipse/milo/opcua/sdk/server/namespaces/loader/*,
                        **/org/eclipse/milo/opcua/stack/core/types/structured/**,
                        **/org/eclipse/milo/opcua/stack/core/types/enumerated/**,
                        **/org/eclipse/milo/opcua/sdk/client/api/model/nodes/objects/*,
                        **/org/eclipse/milo/opcua/sdk/client/api/model/nodes/variables/*,
                        **/org/eclipse/milo/opcua/sdk/client/api/model/types/objects/*,
                        **/org/eclipse/milo/opcua/sdk/client/api/model/types/variables/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/methods/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/nodes/objects/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/nodes/variables/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/types/objects/*,
                        **/org/eclipse/milo/opcua/sdk/server/model/types/variables/*,
                        **/org/eclipse/milo/opcua/stack/core/Identifiers.java,
                        **/org/eclipse/milo/opcua/stack/core/types/builtin/unsigned/*,
                        **/org/eclipse/milo/opcua/stack/core/StatusCodes.java
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

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