<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<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>cn.hackyo</groupId>
  <artifactId>winrm4j-parent</artifactId>
  <version>0.13.0</version> <!-- WINRM4J_VERSION -->
  <packaging>pom</packaging>
  <name>WinRM Parent</name>
  <description>
      A WinRM library for Java
  </description>

  <url>https://github.com/hackyoMa/winrm4j</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>hackyo</name>
      <email>137120918@qq.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/hackyoMa/winrm4j.git</connection>
    <developerConnection>scm:git:git@github.com:hackyoMa/winrm4j.git</developerConnection>
    <url>https://github.com/hackyoMa/winrm4j</url>
  </scm>

  <properties>
    <!-- Compilation -->
    <java.version>17</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- Testing -->
    <includedTestGroups />
    <excludedTestGroups>Integration,Acceptance,Live,WIP</excludedTestGroups>
    <surefire.failIfNoSpecifiedTests>false</surefire.failIfNoSpecifiedTests>
    <surefire.version>2.22.0</surefire.version>
    <testng.version>6.9.10</testng.version>
    <guava.version>18.0</guava.version>
    <mockwebserver.version>4.10.0</mockwebserver.version>

    <!-- Production -->
    <cxf.version>4.0.0</cxf.version>
    <cxf.java2ws.plugin.version>${cxf.version}</cxf.java2ws.plugin.version>
    <httpcomponents.httpcore.version>4.4.16</httpcomponents.httpcore.version>
    <httpcomponents.httpasyncclient.version>4.1.5</httpcomponents.httpasyncclient.version>
    <httpcomponents.httpclient.version>4.5.14</httpcomponents.httpclient.version>
    <commons-io.version>2.4</commons-io.version>
    <xmlunit.version>2.8.1</xmlunit.version>
  </properties>

  <modules>
    <module>service</module>
    <module>client</module>
    <module>winrm4j</module>
  </modules>


  <dependencies>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>${testng.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <mavenExecutorId>forked-path</mavenExecutorId>
          <useReleaseProfile>true</useReleaseProfile>
          <releaseProfiles>Release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
          </supportedProjectTypes>
          <instructions>
            <!-- Brooklyn-Feature prefix triggers inclusion of the project's metadata in the server's features list. -->
            <Brooklyn-Feature-Name>${project.name}</Brooklyn-Feature-Name>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>
<!-- disable enforcer - too many maven versions get confused eg commons-codec, etc, esp w ws-security added
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce</id>
            <phase>none</phase>
          </execution>
          <execution>
            <id>brooklyn-build-req</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <inherited>true</inherited>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>${java.version}.0</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>[3.0.0,)</version>
                </requireMavenVersion>
                <dependencyConvergence/>
              </rules>
            </configuration>
          </execution>
      </executions>
    </plugin>
-->
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.11.0</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jvnet.jax-ws-commons</groupId>
          <artifactId>jaxws-maven-plugin</artifactId>
          <version>2.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-java2ws-plugin</artifactId>
          <version>${cxf.java2ws.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-codegen-plugin</artifactId>
          <version>${cxf.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.12</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.4.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>5.1.8</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-eclipse-plugin</artifactId>
          <version>2.10</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${surefire.version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
        <!--This plugin's configuration is used to store Eclipse m2e settings 
          only. It has no influence on the Maven build itself. -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <versionRange>[2.4.1,)</versionRange>
                    <goals>
                      <goal>single</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <versionRange>[1.7,)</versionRange>
                    <goals>
                      <goal>attach-artifact</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <versionRange>[1.3.1,)</versionRange>
                    <goals>
                      <goal>enforce</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-remote-resources-plugin</artifactId>
                    <versionRange>[1.5,)</versionRange>
                    <goals>
                      <goal>process</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[2.8,)</versionRange>
                    <goals>
                      <goal>unpack</goal>
                      <goal>copy</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.github.skwakman.nodejs-maven-plugin</groupId>
                    <artifactId>nodejs-maven-plugin</artifactId>
                    <versionRange>[1.0.3,)</versionRange>
                    <goals>
                      <goal>extract</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <versionRange>[2.4,)</versionRange>
                    <goals>
                      <goal>exploded</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <!--
      Make release build (e.g. for Sonatype) with -PRelease
      Note that a sonatype release requires signed artifacts, javadoc and source jars; 
      this snippet doesn't do everything, as you need to set up a key etc,
      but it should get you a long way there (and prevent maven faffing).
      If you don't deploy you can delete or ignore this (it has no effect unless you 
      enter -PRelease).

      Add the following to your ~/.m2/settings.xml to be able to build without supplying
      your gpg password on the command line:

      <profiles>
          <profile>
              <id>gpg</id>
              <properties>
                  <gpg.executable>gpg2</gpg.executable>
                  <gpg.useAgent>true</gpg.useAgent>
                  <useAgent>true</useAgent>
                  <gpg.useagent>true</gpg.useagent>
              </properties>
          </profile>
      </profiles>
      <activeProfiles>
          <activeProfile>gpg</activeProfile>
      </activeProfiles>
    -->
    <profile>
      <id>Release</id>
      <activation>
        <property>
          <name>performRelease</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <inherited>true</inherited>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>verify</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <!-- disable 'use' reporting because of NPE deploying to sonatype: 
                   http://stackoverflow.com/questions/888199/why-does-maven-install-fail-during-javadoc-generation 
                   http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=ac084ab7f47c4e7f1df2117cecd?bug_id=5101868 -->
              <use>false</use>
              <keywords>true</keywords>
              <author>false</author>
              <quiet>true</quiet>
              <detectLinks />
              <tags>
                <tag>
                  <name>todo</name>
                  <placement>a</placement>
                  <head>To-do:</head>
                </tag>
              </tags>
              
              <!-- See https://stackoverflow.com/questions/15886209/maven-is-not-working-in-java-8-when-javadoc-tags-are-incomplete 
              -->
              <additionalJOption>-Xdoclint:all</additionalJOption>
              <additionalJOption>-Xdoclint:-missing</additionalJOption>
              
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
            </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
            </configuration>
          </plugin>
          </plugins>
      </build>
    </profile>

    <!-- different properties used to deploy to different locations depending on profiles;
         default is cloudsoft filesystem repo, but some sources still use cloudsoft artifactory as source
         (and soon we will support artifactory)
    -->
    <profile>
      <id>sonatype-nexus-repo</id>
      <activation> <property><name>deployTo</name><value>sonatype</value></property> </activation>
      <distributionManagement>
        <repository>
          <id>sonatype-nexus-staging</id>
          <name>Nexus Release Repository</name>
          <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
          <id>sonatype-nexus-snapshots</id>
          <name>Sonatype Nexus Snapshots</name>
          <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
      </distributionManagement>
    </profile>

    <profile>
      <id>Tests</id>
      <activation>
        <file> <exists>${basedir}/src/test</exists> </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <enableAssertions>true</enableAssertions>
              <groups>${includedTestGroups}</groups>
              <excludedGroups>${excludedTestGroups}</excludedGroups>
              <testFailureIgnore>false</testFailureIgnore>
              <printSummary>true</printSummary>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <inherited>true</inherited>
            <executions>
              <execution>
                <id>test-jar-creation</id>
                <goals>
                  <goal>test-jar</goal>
                </goals>
                <configuration>
                  <forceCreation>true</forceCreation>
                  <archive combine.self="override" />
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>Integration</id>
      <properties>
        <includedTestGroups>Integration</includedTestGroups>
        <excludedTestGroups>Acceptance,Live,WIP</excludedTestGroups>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>test-jar-creation</id>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>Live</id>
      <properties>
        <includedTestGroups>Live</includedTestGroups>
        <excludedTestGroups>Integration,Acceptance,WIP</excludedTestGroups>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>test-jar-creation</id>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>Acceptance</id>
      <properties>
        <includedTestGroups>Acceptance</includedTestGroups>
        <excludedTestGroups>Integration,Live,WIP</excludedTestGroups>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>test-jar-creation</id>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>
