<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.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
        <relativePath />
    </parent>
    
    <groupId>org.helgoboss</groupId>
    <artifactId>my-scala-oss-parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>
    <name>My OSS Parent POM</name>
    <description>Common parent POM for all my Scala projects which are supposed to be published on Sonatype OSS</description>
    
    
    <url>https://github.com/helgoboss/my-scala-oss-parent</url>
    <scm>
        <url>https://github.com/helgoboss/my-scala-oss-parent</url>
        <connection>scm:git:https://github.com/helgoboss/my-scala-oss-parent</connection>
        <developerConnection>scm:git:https://github.com/helgoboss/my-scala-oss-parent</developerConnection>
    </scm>
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Benjamin Klum</name>
            <email>benjamin.klum@helgoboss.org</email>
        </developer>
    </developers>
    
    <build>
        <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
    </build>
    
    <profiles>
        <profile>
            <id>sonatype-oss-release</id>
            <build>
                <plugins>
                
                    <!-- Unpack dependency sources of helgoboss projects so Scaladoc can include them -->
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.6</version>
                        <executions>
                          <execution>
                            <id>unpack-sources</id>
                            <goals>
                              <goal>unpack-dependencies</goal>
                            </goals>
                            <configuration>
                              <outputDirectory>${project.build.directory}/sources</outputDirectory>
                              <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                              <classifier>sources</classifier>
                              <includeGroupIds>org.helgoboss</includeGroupIds>
                              <scope>compile</scope>
                            </configuration>
                          </execution>
                        </executions>
                    </plugin>
                    
                    <!-- Let Scaladoc include the dependency sources -->
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <version>3.1.3</version>
                        <executions>
                            <execution>
                                <id>scaladoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>doc</goal>
                                </goals>
                                <configuration>
                                    <sourceDir>${project.build.directory}/sources</sourceDir>
                                    <args>
                                        <arg>-groups</arg>
                                        <arg>-implicits</arg>
                                    </args>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <!-- Point the javadoc plugin to the scaladocs directory so we get a javadoc artifact -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <outputDirectory>${project.build.directory}/site/scaladocs</outputDirectory>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
