<!--

    Copyright 2011-2022 Erwin Müller <erwin.mueller@anrisoftware.com>

    Licensed 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>
        <artifactId>globalpom-groovy-parent</artifactId>
        <groupId>com.anrisoftware.globalpom</groupId>
        <version>4.6.2</version>
    </parent>

    <artifactId>globalpom-groovy</artifactId>
    <packaging>pom</packaging>
    <name>Global POM :: Groovy</name>
    <description>Adds Groovy support to compile Groovy sources and test sources.</description>
    <inceptionYear>2011</inceptionYear>
    <url>https://javadoc.anrisoftware.com/${project.groupId}/${project.artifactId}/${project.version}/</url>

    <properties>
        <sonar.groovy.binaries>target/classes</sonar.groovy.binaries>
    </properties>

    <scm>
        <connection>${globalpom.custom.scm.pub}</connection>
        <developerConnection>${globalpom.custom.scm.dev}</developerConnection>
        <url>${globalpom.custom.scm.url}</url>
        <tag>HEAD</tag>
    </scm>

    <distributionManagement>
        <site>
            <id>site-dav</id>
            <url>${site.dav.url}</url>
        </site>
        <repository>
            <id>public_releases</id>
            <url>https://maven.anrisoftware.com/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>public_snapshots</id>
            <url>https://maven.anrisoftware.com/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                    <source>${globalpom.custom.source.source}</source>
                    <target>${globalpom.custom.source.target}</target>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>${globalpom.custom.groovy-eclipse-compiler.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>${globalpom.custom.groovy-eclipse-batch.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Define Groovy Eclipse Compiler again and set extensions=true.
                Thanks to this, plugin will -->
            <!-- enhance default build life cycle with an extra phase which
                adds additional Groovy source folders -->
            <!-- Thanks to this, Clover will be able to find your Groovy
                files. It works with Maven 3.x -->
            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>${globalpom.custom.groovy-eclipse-compiler.version}</version>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-groovydocs-to-site</id>
                        <phase>site</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.reporting.outputDirectory}/groovydocs</outputDirectory>
                            <overwrite>true</overwrite>
                            <resources>
                                <resource>
                                    <directory>${project.build.directory}/groovydoc</directory>
                                    <includes>
                                        <include>**/*</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

</project>
