<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>
  
  <properties>
    <net-lecousin-parent-pom-version>0.6</net-lecousin-parent-pom-version>
  	<maven-checkstyle-version>2.17</maven-checkstyle-version>
	<checkstyle-version>8.5</checkstyle-version>
  	<maven-spotbugs-version>3.1.0</maven-spotbugs-version>
  	<spotbugs-version>3.1.0</spotbugs-version>
  </properties>
  
  <groupId>net.lecousin</groupId>
  <artifactId>parent-pom</artifactId>
  <version>${net-lecousin-parent-pom-version}</version>
  <packaging>pom</packaging>
  
  <name>lecousin.net parent POM</name>
  <description>This POM defines common properties and plugins for other projects, such as checkstyle, spotbugs or Java version</description>
  <url>https://github.com/lecousin/java-parent-pom</url>
  
  <licenses>
    <license>
      <name>Apache 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
    
  <developers>
    <developer>
    	<id>lecousin</id>
    	<name>Guillaume Le Cousin</name>
    </developer>
  </developers>
  
  <scm>
    <connection>scm:git:https://github.com/lecousin/java-parent-pom.git</connection>
    <developerConnection>scm:git:ssh://git@github.com:lecousin/java-parent-pom.git</developerConnection>
    <url>https://github.com/lecousin/java-parent-pom</url>
    <tag>HEAD</tag>
  </scm>
  
  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
        <id>ossrh</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
  
  <dependencyManagement>
  	<dependencies>
  		<dependency>
	  		<groupId>com.github.spotbugs</groupId>
	  		<artifactId>spotbugs-annotations</artifactId>
	  		<version>${spotbugs-version}</version>
  		</dependency>
  	</dependencies>
  </dependencyManagement>
  <build>
  	<pluginManagement>
  		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.2</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.0.2</version>
			</plugin>
  			<plugin>
  				<groupId>org.apache.maven.plugins</groupId>
  				<artifactId>maven-dependency-plugin</artifactId>
  				<version>3.0.1</version>
  				<executions>
  					<execution>
  						<id>unpack-parent-resources</id>
  						<phase>generate-resources</phase>
  						<goals>
  							<goal>unpack</goal>
  						</goals>
  						<configuration>
  							<artifactItems>
  								<artifactItem>
  									<groupId>net.lecousin</groupId>
  									<artifactId>parent-pom</artifactId>
  									<version>${net-lecousin-parent-pom-version}</version>
  									<type>zip</type>
  									<classifier>resources-files</classifier>
  									<overWrite>true</overWrite>
  									<outputDirectory>${project.build.directory}/lc-parent-resources</outputDirectory>
  								</artifactItem>
  							</artifactItems>
  							<includes>**/*</includes>
  							<overWriteReleases>true</overWriteReleases>
  							<overWriteSnapshots>true</overWriteSnapshots>
  						</configuration>
  					</execution>
  				</executions>
  			</plugin>
  			<plugin>
  				<groupId>org.apache.maven.plugins</groupId>
  				<artifactId>maven-checkstyle-plugin</artifactId>
  				<version>${maven-checkstyle-version}</version>
				<dependencies>
					<dependency>
						<groupId>com.puppycrawl.tools</groupId>
						<artifactId>checkstyle</artifactId>
						<version>${checkstyle-version}</version>
					</dependency>
				</dependencies>
  				<executions>
  					<execution>
  						<id>verify-checkstyle</id>
  						<phase>verify</phase>
  						<goals>
  							<goal>check</goal>
  						</goals>
		  				<configuration>
		  					<configLocation>${project.build.directory}/lc-parent-resources/checkstyle.xml</configLocation>
		  					<encoding>UTF-8</encoding>
		  				</configuration>
  					</execution>
  				</executions>
  			</plugin>
  			<plugin>
  				<groupId>com.github.spotbugs</groupId>
  				<artifactId>spotbugs-maven-plugin</artifactId>
  				<version>${maven-spotbugs-version}</version>
  				<executions>
  					<execution>
  						<id>verify-spotbugs</id>
  						<phase>verify</phase>
  						<goals>
  							<goal>spotbugs</goal>
  						</goals>
  						<configuration>
  							<xmlOutput>true</xmlOutput>
  						</configuration>
  					</execution>
  				</executions>
  			</plugin>
  		</plugins>
  	</pluginManagement>
  	
  	<plugins>
  		<plugin>
  			<artifactId>maven-assembly-plugin</artifactId>
  			<inherited>false</inherited>
  			<configuration>
  				<descriptors>
  					<descriptor>${project.basedir}/src/assembly/zip.xml</descriptor>
  				</descriptors>
  			</configuration>
  			<executions>
  				<execution>
  					<id>make-assembly</id>
  					<phase>package</phase>
  					<goals>
  						<goal>single</goal>
  					</goals>
  				</execution>
  			</executions>
  		</plugin>
  	</plugins>
  </build>
  
  <profiles>
    <profile>
        <id>ossrh</id>
        <activation>
            <property>
                <name>ossrh</name>
                <value>true</value>
            </property>
        </activation>
        <build>
        	<plugins>
		  		<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>1.5</version>
					<executions>
						<execution>
							<id>sign-artifacts</id>
							<phase>verify</phase>
							<goals>
								<goal>sign</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
        	</plugins>
        </build>
    </profile>
  </profiles>
</project>