<?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>
    <parent>
        <groupId>org.apache.camel.quarkus</groupId>
        <artifactId>camel-quarkus-parent</artifactId>
        <version>0.3.0</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <artifactId>camel-quarkus-build-parent</artifactId>
    <packaging>pom</packaging>

    <name>Camel Quarkus :: Build Parent</name>
    <description>Maven plugins configuration</description>

    <properties>
        <mock-javamail.version>1.9</mock-javamail.version>

        <!-- maven-surefire-plugin -->
        <failIfNoTests>false</failIfNoTests>

        <maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
        <maven-checkstyle.version>7.6.1</maven-checkstyle.version>
        <jandex-maven-plugin.version>1.0.6</jandex-maven-plugin.version>
        <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
        <docker-maven-plugin.version>0.3.0</docker-maven-plugin.version>
        <directory-maven-plugin.version>0.3.1</directory-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jvnet.mock-javamail</groupId>
                <artifactId>mock-javamail</artifactId>
                <version>${mock-javamail.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.mail</groupId>
                        <artifactId>mail</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>io.quarkus</groupId>
                    <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
                    <version>${quarkus.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>extension-descriptor</goal>
                            </goals>
                            <phase>compile</phase>
                            <configuration>
                                <deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}
                                </deployment>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <quiet>true</quiet>
                        <doclint>none</doclint>
                        <show>package</show>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.gmaven</groupId>
                    <artifactId>groovy-maven-plugin</artifactId>
                    <version>${groovy-maven-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy-all</artifactId>
                            <version>${groovy.version}</version>
                            <type>pom</type>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.commonjava.maven.plugins</groupId>
                <artifactId>directory-maven-plugin</artifactId>
                <version>${directory-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>directories</id>
                        <goals>
                            <goal>highest-basedir</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <property>camel.quarkus.project.root</property>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>sanity-checks</id>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <source>file://${camel.quarkus.project.root}/build/scripts/validate-dependencies.groovy</source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>sourcecheck</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <version>${maven-checkstyle-plugin.version}</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.camel</groupId>
                                <artifactId>camel-buildtools</artifactId>
                                <version>${camel.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.puppycrawl.tools</groupId>
                                <artifactId>checkstyle</artifactId>
                                <version>${maven-checkstyle.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>default-cli</id>
                                <phase>validate</phase>
                                <configuration>
                                    <includeResources>false</includeResources>
                                    <configLocation>camel-checkstyle.xml</configLocation>
                                    <consoleOutput>true</consoleOutput>
                                    <failsOnError>${checkstyle.failOnViolation}</failsOnError>
                                    <linkXRef>false</linkXRef>
                                    <suppressionsLocation>camel-checkstyle-suppressions.xml</suppressionsLocation>
                                    <encoding>UTF-8</encoding>
                                    <sourceDirectories>
                                        <sourceDirectory>${basedir}/src</sourceDirectory>
                                    </sourceDirectories>
                                    <headerLocation>header-java.txt</headerLocation>
                                    <includes>**/*.java,**/*.groovy,**/*.scala,**/*.properties,**/*.xml,**/*.xsd</includes>
                                    <excludes>**/MyRoutes*.java,**/Target*.java,**/*Substitutions.java</excludes>
                                </configuration>
                                <goals>
                                    <goal>checkstyle</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
