<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>com.acoinfo</groupId>
  <artifactId>com.acoinfo.vsoa</artifactId>
  <packaging>jar</packaging>
  <version>1.0.1</version>
  <name>VSOA SDK for Java</name>
  <description>VSOA is the abbreviation of Vehicle SOA presented by ACOINFO, VSOA provides a reliable, Real-Time SOA (Service Oriented Architecture) framework, this framework has multi-language and multi-environment implementation, developers can use this framework to build a distributed service model.</description>
  <url>https://docs.acoinfo.com/cloudnative/vsoa/basicdev/framework/vsoa_basics.html</url>


  <developers>
    <developer>
      <id>jiangtaijin</id>
      <name>jiangtaijin</name>
      <email>jiangtaijin@acoinfo.com</email>
    </developer>
  </developers>

  <properties>
    <java.version>8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
  </properties>

  <scm>
    <url>https://github.com/acoinfo</url>
  </scm>

  <licenses>
    <license>
      <name>/</name>
      <url>/</url>
    </license>
  </licenses>

  <build>
    <sourceDirectory>.</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>8</source>
          <target>8</target>
          <excludes>
            <exclude>test/*.java</exclude>
            <exclude>example/*.java</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <dependencies>
          <dependency>
            <groupId>com.yworks</groupId>
            <artifactId>yguard</artifactId>
            <version>3.1.0</version>
          </dependency>
        </dependencies>
        <configuration>
          <goalPrefix>build</goalPrefix>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <id>obfuscate</id>
            <configuration>
              <tasks>
                <property name="runtime_classpath" refid="maven.runtime.classpath"/>
                <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${runtime_classpath}"/>
                <yguard>
                  <inoutpair  in="${project.build.directory}/${project.build.finalName}.jar"
                              out="${project.build.directory}/${project.build.finalName}.jar" />
                  <!-- don't let the obfuscator remove the "Deprecated" -->
                  <!-- attributes from the .class file entries -->
                  <attribute name="Deprecated"/>
                  <!--                          <shrink logfile="${project.build.directory}/yshrink.log.xml">-->
                  <!--                          </shrink>-->
                  <rename logfile="${project.build.directory}/yguard.log.xml">
                    <keep>
                      <class classes="public"
                             methods="public"
                             fields="public"/>
                      <method class="com.acoinfo.vsoa.Client" name="void onError(com.acoinfo.vsoa.Error)"/>
                      <method class="com.acoinfo.vsoa.Client" name="void onMessage(java.lang.String,com.acoinfo.vsoa.Payload,boolean)"/>
                      <method class="com.acoinfo.vsoa.Client" name="void onConnected(java.lang.String)"/>
                      <method class="com.acoinfo.vsoa.Client" name="void onUnsubscribe(java.lang.String[])"/>
                      <method class="com.acoinfo.vsoa.Client" name="void onSubscribe(java.lang.String[])"/>
                      <method class="com.acoinfo.vsoa.Client" name="void onDatagram(java.lang.String,com.acoinfo.vsoa.Payload,boolean)"/>
                      <package>
                        <patternset>
                          <include name="test"/>
                        </patternset>
                      </package>
                    </keep>
                  </rename>
                </yguard>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.7</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <phase>deploy</phase>
              </execution>
            </executions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
              <stagingProgressTimeoutMinutes>20</stagingProgressTimeoutMinutes>
            </configuration>
          </plugin>

          <!--生成源码文件插件-->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
              <attach>true</attach>
              <excludes>
                <exclude>.idea/**/*.*</exclude>
                <exclude>target/**/*.*</exclude>
                <exclude>com/**/*.java</exclude>
                <exclude>test/*.java</exclude>
                <exclude>example/*.javaww</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!--生成javadoc插件-->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.0.1</version>
            <configuration>
              <excludePackageNames>com.*,example,test</excludePackageNames>
              <!-- 防止文档不规范报错 -->
              <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!--生成依赖jar包插件-->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
              <execution>
                <id>copy-dependencies</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                  <overWriteReleases>false</overWriteReleases>
                  <overWriteSnapshots>false</overWriteSnapshots>
                  <overWriteIfNewer>true</overWriteIfNewer>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- GPG -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
          <id>ossrh</id>
          <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>
    </profile>
  </profiles>
</project>