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

  <artifactId>closure-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>

  <parent>
    <groupId>com.google.closure</groupId>
    <artifactId>parent</artifactId>
    <version>1.1.0</version>
    <relativePath>..</relativePath>
  </parent>

  <name>Closure Maven Plugin</name>
  <description>
    A plugin that eases web application building by integrating
    Closure Compiler (JS), Closure Templates, Closure StyleSheets,
    and Protocol Buffers.
  </description>

  <dependencies>
    <dependency>
      <groupId>com.google.closure</groupId>
      <artifactId>soy-juice</artifactId>
      <version>${project.version}</version>  <!-- sibling module -->
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.javascript</groupId>
      <artifactId>closure-compiler-unshaded</artifactId>
    </dependency>
    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.closure-stylesheets</groupId>
      <artifactId>closure-stylesheets</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.template</groupId>
      <artifactId>soy</artifactId>
    </dependency>
    <!-- Order this last so that the explicit maven deps
         above trump this one -->
    <dependency>
      <groupId>com.comoyo.maven.plugins</groupId>
      <artifactId>protoc-bundled-plugin</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.common.html.types</groupId>
      <artifactId>types</artifactId>
    </dependency>
  </dependencies>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <reportSets>
          <reportSet>
            <id>html</id>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
          <reportSet>
            <id>configuration</id>
            <configuration>
              <doclet>com.google.closure.doclet.PluginConfigDoclet</doclet>

              <!-- <docletPath>/path/to/doccheck.jar</docletPath> -->
              <docletArtifacts>
                <docletArtifact>
                  <groupId>com.google.closure</groupId>
                  <artifactId>doclet</artifactId>
                  <version>${project.version}</version>
                </docletArtifact>
              </docletArtifacts>

              <destDir>${project.build.directory}/site</destDir>

              <!-- For the project-reports page-->
              <name>site-configuration-docs</name>
              <description>
                Generate pages for the project site that describe configuration options
              </description>
            </configuration>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.4</version>
      </plugin>
    </plugins>
  </reporting>

  <build>
    <defaultGoal>verify</defaultGoal>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <!-- Unpack/copy core dependencies into  -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>process-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.google.common.html.types</groupId>
                  <artifactId>proto</artifactId>
                  <version>1.0.5</version>
                  <type>jar</type>
                  <!-- This is heavy handed, but avoids problems with Eclipse m2e wiping out
                       target/classes directory but not the markersDirectory where this plugin
                       stores unpack state -->
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.outputDirectory}/src/main/proto</outputDirectory>
                  <includes>**/*.proto</includes>
                </artifactItem>
                <artifactItem>
                  <groupId>com.google.template</groupId>
                  <artifactId>soy</artifactId>
                  <version>${soy.version}</version>
                  <type>jar</type>
                  <classifier>jssrc_js</classifier>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.outputDirectory}/src/main/js/soy</outputDirectory>
                  <includes>**/*.js</includes>
                  <excludes>examples/**/*.js</excludes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-jspb</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/src/main/js/jspb</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.parent.basedir}/submodules/protobuf/js</directory>
                  <includes>
                    <include>debug.js</include>
                    <include>message.js</include>
                    <include>map.js</include>
                  </includes>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-closure</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/src/main/js/goog</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.parent.basedir}/submodules/closure-library/closure/goog</directory>
                  <includes>
                    <include>**/*.js</include>
                  </includes>
                  <excludes>
                    <include>**/*_test.js</include>
                  </excludes>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
        </plugin>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>
                      org.apache.maven.plugins
                    </groupId>
                    <artifactId>
                      maven-dependency-plugin
                    </artifactId>
                    <versionRange>[2.10,)</versionRange>
                    <goals>
                      <goal>copy</goal>
                      <goal>unpack</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
