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

  <groupId>com.google.closure</groupId>
  <artifactId>parent</artifactId>
  <version>1.1.0</version>
  <packaging>pom</packaging>
  <prerequisites>
    <maven>3</maven>
  </prerequisites>

  <name>Closure Maven</name>

  <description>Tools and Utilities related to Google Closure</description>

  <url>http://github.com/mikesamuel/closure-maven-plugin</url>

  <modules>
    <module>doclet</module>
    <module>module</module>
    <module>plugin</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <csscomp.version>1.3.0</csscomp.version>
    <jscomp.version>v20160822</jscomp.version>
    <protoc-plugin.version>1.4.56</protoc-plugin.version>
    <soy.version>2016-08-25</soy.version>
    <java.source.version>1.7</java.source.version>
    <!-- Used in a resource filter -->
    <protobuf-java.version>3.0.0</protobuf-java.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>3.3.9</version>
        <exclusions>
          <exclusion>  <!-- clobbers guava with an older crappier one. -->
            <groupId>org.sonatype.sisu</groupId>
            <artifactId>sisu-guava</artifactId>
          </exclusion>
          <exclusion>  <!-- clobbers guice with an older crappier one. -->
            <groupId>org.sonatype.sisu</groupId>
            <artifactId>sisu-guice</artifactId>
          </exclusion>
          <exclusion>  <!-- actually depends on two versions.  We pick one below. -->
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>3.4</version>
        <exclusions>
          <exclusion>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-utils</artifactId>
        <version>3.0.22</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>19.0</version>
        <type>jar</type>
      </dependency>
      <dependency>
        <groupId>com.google.javascript</groupId>
        <artifactId>closure-compiler-unshaded</artifactId>
        <version>${jscomp.version}</version>
        <exclusions>
          <exclusion>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
        <exclusions>
          <exclusion>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.closure-stylesheets</groupId>
        <artifactId>closure-stylesheets</artifactId>
        <version>${csscomp.version}</version>
        <exclusions>
          <exclusion>
            <groupId>args4j</groupId>
            <artifactId>args4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.javascript</groupId>
            <artifactId>closure-compiler</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.template</groupId>
        <artifactId>soy</artifactId>
        <version>${soy.version}</version>
        <exclusions>
          <exclusion>
            <groupId>args4j</groupId>
            <artifactId>args4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.common.html.types</groupId>
            <artifactId>types</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.comoyo.maven.plugins</groupId>
        <artifactId>protoc-bundled-plugin</artifactId>
        <version>${protoc-plugin.version}</version>
        <exclusions>
          <exclusion>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
          </exclusion>
          <exclusion>  <!-- TODO: Is this needed? -->
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-project</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-repository-metadata</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-classworlds</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
          </exclusion>
          <exclusion>  <!-- clobbers guava with an older crappier one. -->
            <groupId>org.sonatype.sisu</groupId>
            <artifactId>sisu-guava</artifactId>
          </exclusion>
          <exclusion>  <!-- clobbers guice with an older crappier one. -->
            <groupId>org.sonatype.sisu</groupId>
            <artifactId>sisu-guice</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.common.html.types</groupId>
        <artifactId>types</artifactId>
        <version>1.0.5</version>
        <exclusions>
          <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>${protobuf-java.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <defaultGoal>verify</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.3.1</version>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.0-beta-4</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>enforce</id>
            <configuration>
              <rules>
                <DependencyConvergence />
                <banDuplicateClasses>
                  <findAllDuplicates>true</findAllDuplicates>
                  <ignoreClasses>
                    <!-- present in both junit and hamcrest-core -->
                    <ignoreClass>org.hamcrest.*</ignoreClass>
                    <ignoreClass>org.hamcrest.core.*</ignoreClass>
                    <!-- everyone seems to package their dependency injection stuff -->
                    <ignoreClass>javax.enterprise.inject.*</ignoreClass>
                    <ignoreClass>javax.inject.*</ignoreClass>
                    <ignoreClass>org.aopalliance.aop.*</ignoreClass>
                    <ignoreClass>org.aopalliance.intercept.*</ignoreClass>
                    <ignoreClass>org.sonatype.inject.*</ignoreClass>
                    <!-- sisu seems to be a cesspit of overlap -->
                    <ignoreClass>org.codehaus.plexus.*</ignoreClass>
                  </ignoreClasses>
                </banDuplicateClasses>
                <enforceBytecodeVersion>
                  <maxJdkVersion>1.7</maxJdkVersion>
                  <excludes>
                    <exclude>com.sun:tools</exclude>
                  </excludes>
                </enforceBytecodeVersion>
              </rules>
              <fail>true</fail>
            </configuration>
            <goals>
              <goal>enforce</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <!-- allow mvn site:stage to build a collected site under target/stage -->
          <topSiteUrl>https://mikesamuel.github.io/closure-maven-plugin/</topSiteUrl>
          <skipDeploy>true</skipDeploy>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>3.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
          <configuration>
            <source>${java.source.version}</source>
            <target>${java.source.version}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.10</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>2.9</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.6</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.4</version>
          <configuration>
            <quiet>true</quiet>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>run-its</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.7</version>
            <configuration>
              <debug>true</debug>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <pomIncludes>
                <pomInclude>*/pom.xml</pomInclude>
              </pomIncludes>
              <postBuildHookScript>verify</postBuildHookScript>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
              <settingsFile>src/it/settings.xml</settingsFile>
              <goals>
                <goal>clean</goal>
                <goal>test</goal>
              </goals>
              <!-- Use the local repository, not a temp space under target so we can
                   experiment with snapshot builds installed locally. -->
              <localRepositoryPath>${localRepository}</localRepositoryPath>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- courtesy http://stackoverflow.com/a/34808603/20394 -->
      <id>relaxed-java8-doclint</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-javadoc-plugin</artifactId>
              <configuration>
                <additionalparam>-Xdoclint:html</additionalparam>
                <additionalparam>-Xdoclint:reference</additionalparam>
                <additionalparam>-Xdoclint:syntax</additionalparam>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <!-- Build steps that only need to run when publishing to Maven Central. -->
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <!-- Sign artifacts with local GPG key. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!-- Create javadoc.jar. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <notimestamp>true</notimestamp>
              <windowtitle>Closure Maven Plugin API</windowtitle>
              <author>false</author>
              <doctitle>
                <![CDATA[
                  <h1>Closure Maven Plugin</h1>
                ]]>
              </doctitle>
              <bottom><![CDATA[
                <p id="copyright">&copy; 2016 Google -
                  <a href="http://www.google.com/privacy.html">Privacy Policy</a> -
                  <a href="http://www.google.com/terms_of_service.html">Terms and Conditions</a> -
                  <a href="http://www.google.com/about.html">About Google</a>
                </p>]]>
              </bottom>
              <!-- Ignore javadoc errors. -->
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadoc</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!-- Create sources.jar. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <inceptionYear>2016</inceptionYear>

  <scm>
    <connection>scm:git:https://github.com/mikesamuel/closure-maven-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:mikesamuel/closure-maven-plugin.git</developerConnection>
    <url>https://github.com/mikesamuel/closure-maven-plugin.git</url>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/mikesamuel/closure-maven-plugin/issues</url>
  </issueManagement>

  <!-- Allow publishing snapshots to Maven Central. -->
  <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>
    <site>
      <id>website</id>
      <url>https://mikesamuel.github.io/closure-maven-plugin/</url>
    </site>
  </distributionManagement>

  <organization>
    <name>Google</name>
    <url>http://www.google.com</url>
  </organization>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Googlers</name>
      <organization>Google</organization>
      <organizationUrl>https://www.google.com</organizationUrl>
    </developer>
  </developers>
</project>
