<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.lodsve</groupId>
    <artifactId>lodsve-parent</artifactId>
    <version>2</version>
    <packaging>pom</packaging>
    <name>lodsve parent</name>
    <description>lodsve的父pom，管理所有的依赖</description>
    <url>https://github.com/lodsve</url>

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

        <lodsve.maven.plugins.shade.version>1.0.0-RELEASE</lodsve.maven.plugins.shade.version>
        <maven.shade.plugin.version>3.0.0</maven.shade.plugin.version>
        <maven.dependency.plugin.version>2.8</maven.dependency.plugin.version>
        <maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.source.plugin.version>2.4</maven.source.plugin.version>
        <maven.clean.plugin.version>2.6.1</maven.clean.plugin.version>
        <maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
        <maven.gpg.plugin.version>1.5</maven.gpg.plugin.version>
        <maven.javadoc.plugin.version>2.10.3</maven.javadoc.plugin.version>
        <nexus.staging.maven.plugin.version>1.6.5</nexus.staging.maven.plugin.version>

        <manifest.built.name>Sun.Hao</manifest.built.name>
    </properties>

    <organization>
        <name>lodsve</name>
        <url>https://github.com/lodsve</url>
    </organization>

    <!-- license -->
    <licenses>
        <license>
            <name>GNU General Public License version 3</name>
            <url>https://opensource.org/licenses/GPL-3.0</url>
        </license>
    </licenses>

    <!-- 开发者 -->
    <developers>
        <developer>
            <id>sunhao</id>
            <name>孙昊</name>
            <email>sunhao.java@gmail.com</email>
            <roles>
                <role>creator</role>
                <role>manager</role>
                <role>developer</role>
                <role>committer</role>
            </roles>
        </developer>
    </developers>

    <!-- issue -->
    <issueManagement>
        <system>Github Issue</system>
        <url>https://github.com/lodsve/lodsve-parent/issues</url>
    </issueManagement>

    <!-- 代码库 -->
    <scm>
        <connection>scm:git:git@github.com:lodsve/lodsve-parent.git</connection>
        <developerConnection>scm:git:git@github.com:lodsve/lodsve-parent.git</developerConnection>
        <url>https://github.com/lodsve/lodsve-parent</url>
    </scm>

    <!-- 仓库 -->
    <repositories>
        <repository>
            <id>default-center</id>
            <name>default center</name>
            <url>http://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>jcenter</id>
            <name>jcenter</name>
            <url>http://jcenter.bintray.com</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven.shade.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven.dependency.plugin.version}</version>
                    <configuration>
                        <overWriteIfNewer>false</overWriteIfNewer>
                        <prependGroupId>true</prependGroupId>
                        <excludeGroupIds>com.lodsve</excludeGroupIds>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- 编译 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <debuglevel>lines,vars,source</debuglevel>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <compilerArgs>
                        <arg>-Xlint:unchecked</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <!-- 生成源代码的插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>${maven.clean.plugin.version}</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/..</directory>
                            <includes>
                                <include>dependency-reduced-pom.xml</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Built-By>${manifest.built.name}</Built-By>
                        </manifestEntries>
                        <addMavenDescriptor>true</addMavenDescriptor>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk-1.8</id>
            <activation>
                <jdk>1.8</jdk>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
            </properties>
        </profile>
        <profile>
            <id>release-oss</id>
            <build>
                <plugins>
                    <!-- GPG,发布maven中央仓库用 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- 生成javadoc的插件 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <show>public</show>
                            <aggregate>true</aggregate>
                            <charset>${project.build.sourceEncoding}</charset>
                            <encoding>${project.build.sourceEncoding}</encoding>
                            <docencoding>${project.build.sourceEncoding}</docencoding>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </plugin>
                    <!-- 在maven仓库中自动close和release的插件 -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus.staging.maven.plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>oss-releases</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <!-- 发布仓库 -->
            <distributionManagement>
                <snapshotRepository>
                    <id>oss-snapshots</id>
                    <name>oss SNAPSHOTS</name>
                    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
                </snapshotRepository>

                <repository>
                    <id>oss-releases</id>
                    <name>oss releases</name>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <id>release-local</id>
            <build>
                <plugins>
                    <!-- 生成javadoc的插件 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <show>public</show>
                            <aggregate>true</aggregate>
                            <charset>${project.build.sourceEncoding}</charset>
                            <encoding>${project.build.sourceEncoding}</encoding>
                            <docencoding>${project.build.sourceEncoding}</docencoding>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <!-- 发布私服 -->
            <distributionManagement>
                <snapshotRepository>
                    <id>local-snapshots</id>
                    <name>local SNAPSHOTS</name>
                    <url>https://nexus.lodsve.com:9000/repository/maven-snapshots/</url>
                </snapshotRepository>

                <repository>
                    <id>local-releases</id>
                    <name>local releases</name>
                    <url>https://nexus.lodsve.com:9000/repository/maven-releases/</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>
</project>