<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>org.reficio</groupId>
    <artifactId>p2-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>1.2.0</version>
    <name>p2-maven-plugin</name>
    <url>http://projects.reficio.org/${project.artifactId}/${project.version}</url>
    <description>Maven plugin for the automation of jars wrapping and p2 site generation</description>

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

        <maven.version>3.3.9</maven.version>
        <maven.annotations.version>3.5</maven.annotations.version>
        <maven.plugin.plugin.version>3.3</maven.plugin.plugin.version>
        <tycho.version>1.0.0</tycho.version>

        <sonatype.aether.version>1.13.1</sonatype.aether.version>
        <eclipse.aether.version>1.1.0</eclipse.aether.version>

        <wagon.version>2.2</wagon.version>
        <gmaven.version>1.5</gmaven.version>
        <gmaven.provider.selection>2.0</gmaven.provider.selection>
        <groovy.version>2.4.8</groovy.version>

        <clover.version>3.3.0</clover.version>
        <clover.license>/private/reficio/clover.license</clover.license>
    </properties>

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

    <inceptionYear>2012</inceptionYear>

    <developers>
        <developer>
            <id>tom.bujok</id>
            <name>Tom Bujok</name>
            <email>tom.bujok@gmail.com</email>
            <organization>Reficio</organization>
            <organizationUrl>www.reficio.org</organizationUrl>
            <roles>
                <role>project lead</role>
                <role>developer</role>
            </roles>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <issueManagement>
        <system>github</system>
        <url>https://github.com/reficio/p2-maven-plugin/issues</url>
    </issueManagement>

    <scm>
        <connection>scm:git:git://github.com/reficio/p2-maven-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:reficio/p2-maven-plugin.git</developerConnection>
        <url>http://github.com/reficio/p2-maven-plugin</url>
    </scm>

    <ciManagement>
        <system>jenkins</system>
        <url>https://reficio.ci.cloudbees.com/job/p2-maven-plugin/</url>
    </ciManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- dependencies to annotations -->
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven.annotations.version}</version>
            <scope>provided</scope>
            <!-- annotations are needed only to build the plugin -->
        </dependency>


        <!-- org.sonatype.aether artifacts ARE provided by Maven 3.0.x -->
        <dependency>
            <groupId>org.sonatype.aether</groupId>
            <artifactId>aether-api</artifactId>
            <version>${sonatype.aether.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.sonatype.aether</groupId>
            <artifactId>aether-util</artifactId>
            <version>${sonatype.aether.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- org eclipse.aether artifacts are NOT provided by Maven 3.1.x -->
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-api</artifactId>
            <version>${eclipse.aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-util</artifactId>
            <version>${eclipse.aether.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-compat</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>21.0</version>
        </dependency>
 		<dependency>
			<groupId>biz.aQute.bnd</groupId>
			<artifactId>biz.aQute.bnd</artifactId>
			<version>3.3.0</version>
		</dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.twdata.maven</groupId>
            <artifactId>mojo-executor</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>3.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.osgi</groupId>
                    <artifactId>org.osgi.core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-p2-extras-plugin</artifactId>
            <version>${tycho.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.7.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.gmaven.runtime</groupId>
            <artifactId>gmaven-runtime-2.0</artifactId>
            <version>${gmaven.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${groovy.version}</version>
        </dependency>
        <dependency>
            <groupId>com.cenqua.clover</groupId>
            <artifactId>clover</artifactId>
            <version>${clover.version}</version>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven.plugin.plugin.version}</version>
                    <configuration>
                        <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                    </configuration>
                    <executions>
                        <execution>
                            <id>mojo-descriptor</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>descriptor</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>${gmaven.version}</version>
                <configuration>
                    <source/>
                    <providerSelection>${gmaven.provider.selection}</providerSelection>
                    <sourceEncoding>UTF-8</sourceEncoding>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generateStubs</goal>
                            <goal>compile</goal>
                            <goal>generateTestStubs</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>${groovy.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-component-metadata</artifactId>
                <version>1.5.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-metadata</goal>
                            <goal>generate-test-metadata</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                    <excludes>
                        <exclude>**/src/test/integration/**/*.*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mycila.maven-license-plugin</groupId>
                <artifactId>maven-license-plugin</artifactId>
                <version>1.10.b1</version>
                <configuration>
                    <strictCheck>true</strictCheck>
                    <basedir>${basedir}</basedir>
                    <header>src/main/resources/license.txt</header>
                    <quiet>false</quiet>
                    <failIfMissing>true</failIfMissing>
                    <aggregate>false</aggregate>
                    <includes>
                        <include>src/**</include>
                        <include>**/test/**</include>
                    </includes>
                    <excludes>
                        <exclude>target/**</exclude>
                        <exclude>**/resources/**</exclude>
                        <exclude>.clover/**</exclude>
                    </excludes>
                    <useDefaultExcludes>true</useDefaultExcludes>
                    <mapping>
                        <jwc>XML_STYLE</jwc>
                        <application>XML_STYLE</application>
                        <myFileExtension>JAVADOC_STYLE</myFileExtension>
                    </mapping>
                    <useDefaultMapping>true</useDefaultMapping>
                    <properties>
                        <year>${project.inceptionYear}</year>
                        <company>Reficio (TM) - Reestablish your software!</company>
                    </properties>
                    <encoding>UTF-8</encoding>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <executions>
                    <execution>
                        <id>attach-tests</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <quiet>true</quiet>
                    <links>
                        <link>http://docs.oracle.com/javase/6/docs/api/</link>
                    </links>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.doxia</groupId>
                        <artifactId>doxia-module-markdown</artifactId>
                        <version>1.3</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.2</version>
                            <configuration>
                                <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                            </configuration>
                            <reports>
                                <report>index</report>
                                <report>project-team</report>
                                <report>help</report>
                                <report>cim</report>
                                <report>issue-tracking</report>
                                <report>license</report>
                                <report>scm</report>
                                <report>summary</report>
                            </reports>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>2.8.1</version>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-jxr-plugin</artifactId>
                            <version>2.2</version>
                            <configuration>
                                <linkJavadoc>true</linkJavadoc>
                                <aggregate>true</aggregate>
                            </configuration>
                            <reportSets>
                                <reportSet>
                                    <reports>
                                        <report>jxr</report>
                                        <report>test-jxr</report>
                                    </reports>
                                </reportSet>
                            </reportSets>
                        </plugin>
                        <plugin>
                            <groupId>com.atlassian.maven.plugins</groupId>
                            <artifactId>maven-clover2-plugin</artifactId>
                            <configuration>
                                <generateHtml>true</generateHtml>
                                <generateXml>true</generateXml>
                                <excludes>
                                    <exclude>**/Logger.java</exclude>
                                </excludes>
                                <licenseLocation>${clover.license}</licenseLocation>
                            </configuration>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>modify-markdown</id>
                        <phase>pre-site</phase>
                        <configuration>
                            <failOnError>false</failOnError>
                            <target>
                                <copy todir="${basedir}/src/site/markdown">
                                    <fileset dir="${basedir}" includes="README.md"/>
                                </copy>
                                <move file="${basedir}/src/site/markdown/README.md" tofile="${basedir}/src/site/markdown/manual.md"/>
                                <replaceregexp file="${basedir}/src/site/markdown/manual.md"
                                               match="```.*"
                                               replace=""
                                               byline="true"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ftp</artifactId>
                <version>2.2</version>
            </extension>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.2</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <id>site</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <executions>
                            <execution>
                                <id>default-cli</id>
                                <configuration>
                                    <tasks>
                                        <echo message="Running ANT for deploying the site..."/>
                                        <property name="project_folder" value="/var/www/projects/${project.artifactId}"/>
                                        <property name="version_folder" value="${project_folder}/${project.version}"/>
                                        <property name="site_tgz" value="${project.artifactId}-${project.version}-site.tgz"/>
                                        <tar destfile="target/${site_tgz}" basedir="target/site" compression="gzip"/>
                                        <echo message="Creating folder for the site ${version_folder}"/>
                                        <sshexec host="${reficio.server}"
                                                 username="${reficio.usr}"
                                                 password="${reficio.pwd}"
                                                 verbose="false"
                                                 command="mkdir -p ${version_folder}"/>
                                        <echo message="Uploading compressed site ${site_tgz}"/>
                                        <scp file="target/${site_tgz}" todir="${reficio.usr}@${reficio.server}:${project_folder}/"
                                             password="${reficio.pwd}" verbose="false"/>
                                        <echo message="Extracting compressed site and cleaning up"/>
                                        <sshexec host="${reficio.server}"
                                                 username="${reficio.usr}"
                                                 password="${reficio.pwd}"
                                                 verbose="false"
                                                 command="rm -rf ${version_folder}/*; tar -C ${version_folder} -xf ${project_folder}/${site_tgz}; rm ${project_folder}/${project.artifactId}-${project.version}-site.tgz"/>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant-jsch</artifactId>
                                <version>1.8.4</version>
                            </dependency>
                            <dependency>
                                <groupId>com.jcraft</groupId>
                                <artifactId>jsch</artifactId>
                                <version>0.1.48</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>clover</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-clover2-plugin</artifactId>
                        <version>${clover.version}</version>
                        <executions>
                            <execution>
                                <id>clover</id>
                            </execution>
                        </executions>
                        <configuration>
                            <generateHtml>true</generateHtml>
                            <generateXml>true</generateXml>
                            <excludes>
                                <exclude>**/Logger.java</exclude>
                            </excludes>
                            <licenseLocation>${clover.license}</licenseLocation>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>gpg</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludes>
                                <exclude>**/*.asc</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>findbugs</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <version>2.4.0</version>
                        <executions>
                            <execution>
                                <id>findbugs</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>findbugs</goal>
                                </goals>
                                <configuration>
                                    <xmlOutput>true</xmlOutput>
                                    <excludeFilterFile>src/main/resources/findbugs-exclude.xml</excludeFilterFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>it</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>1.9</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                                <version>${groovy.version}</version>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <addTestClassPath>true</addTestClassPath>
                            <projectsDirectory>src/test/integration</projectsDirectory>
                            <streamLogs>true</streamLogs>
                            <showErrors>true</showErrors>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <pomIncludes>
                                <pomInclude>*/pom.xml</pomInclude>
                                <pomInclude>compile/*/pom.xml</pomInclude>
                                <pomInclude>execute/*/pom.xml</pomInclude>
                                <pomInclude>sources/*/pom.xml</pomInclude>
                            </pomIncludes>
                            <settingsFile>src/test/integration/settings.xml</settingsFile>
                            <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
                            <preBuildHookScript>setup.groovy</preBuildHookScript>
                            <postBuildHookScript>validate.groovy</postBuildHookScript>
                            <properties>
                                <gmaven.logging>TRACE</gmaven.logging>
                            </properties>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <!-- required to get the reficio-skin -->
        <repository>
            <id>reficio</id>
            <url>http://repo.reficio.org/maven/</url>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>reficio</id>
            <name>Reficio Maven Repository</name>
            <url>scp://${reficio.server}/var/www/repo/maven</url>
        </repository>
    </distributionManagement>

</project>
