<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>edu.wisc.my.apps</groupId>
  <artifactId>uw-frame</artifactId>
  <packaging>war</packaging>
  <version>3.0.3</version>
  <name>uw-frame-parent</name>
  <description>Frame for UW AngularJS applications</description>
  <url>https://github.com/UW-Madison-DoIT/uw-frame</url>

  <developers>
    <developer>
        <email>my-admin@lists.wisc.edu</email>
        <organization>UW-Madison</organization>
        <url>https://github.com/UW-Madison-DoIT/uw-frame</url>
        <name>My UW Dev Team</name>
    </developer>
  </developers>

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

  <scm>
    <connection>scm:git:git@github.com:UW-Madison-DoIT/uw-frame.git</connection>
    <developerConnection>scm:git:git@github.com:UW-Madison-DoIT/uw-frame.git</developerConnection>
    <url>https://github.com/UW-Madison-DoIT/uw-frame</url>
    <tag>uw-frame-maven-3.0.3</tag>
  </scm>

  <properties>
    <spring.version>4.1.5.RELEASE</spring.version>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <webapp.target.directory>${project.build.directory}/${project.build.finalName}</webapp.target.directory>
  </properties>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>jstl-api</artifactId>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
    </dependency>
  </dependencies>

  <build>
    <finalName>frame</finalName>
    <resources>
      <resource>
        <directory>src/main/webapp</directory>
        <includes>
          <include>frame.jsp</include>
        </includes>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>
      <plugin>
          <groupId>pl.project13.maven</groupId>
          <artifactId>git-commit-id-plugin</artifactId>
          <version>2.1.13</version>
          <executions>
              <execution>
                  <phase>validate</phase>
                  <goals>
                      <goal>revision</goal>
                   </goals>
              </execution>
          </executions>
          <configuration>
              <dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
              <generateGitPropertiesFile>false</generateGitPropertiesFile>
              <skip>false</skip>
          </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <!-- here the phase you need -->
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/frame/staticFeeds</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/filtered-resources</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-components-over</id>
            <phase>validate</phase>
            <goals><goal>copy-resources</goal></goals>
            <configuration>
              <outputDirectory>${basedir}/target/frame/</outputDirectory>
              <resources>
                <resource>
                  <directory>../uw-frame-components</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.3.0.M2</version>
        <configuration>
          <webApp>
            <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
              <resourcesAsCSV>src/main/webapp,${webapp.target.directory},../uw-frame-components</resourcesAsCSV>
            </baseResource>
          </webApp>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
          <localCheckout>true</localCheckout>
          <tagNameFormat>uw-frame-maven-@{project.version}</tagNameFormat>
          <pushChanges>false</pushChanges>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.5</version>
        <extensions>false</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3.2</version>
        <executions>
        <!-- The following will ensure `npm install` is called
          before anything else during the 'Default Lifecycle' -->
            <execution>
              <id>npm install (initialize)</id>
              <goals>
                <goal>exec</goal>
              </goals>
              <phase>initialize</phase>
              <configuration>
                <executable>npm</executable>
                <arguments>
                  <argument>install</argument>
                </arguments>
              </configuration>
            </execution>

            <!-- When you compile the maven build, compile the less-->
            <execution>
            <id>npm run build (compile)</id>
              <goals>
                <goal>exec</goal>
              </goals>
              <phase>compile</phase>
              <configuration>
                <executable>npm</executable>
                <arguments>
                  <argument>run</argument>
                  <argument>build-static</argument>
                </arguments>
              </configuration>
            </execution>

            <!-- Before you can package, move the generated css files over -->
            <execution>
              <id>npm set java version</id>
              <goals>
                <goal>exec</goal>
              </goals>
              <phase>prepare-package</phase>
              <configuration>
                <executable>npm</executable>
                <arguments>
                  <argument>config</argument>
                  <argument>set</argument>
                  <argument>uw-frame:javaversion</argument>
                  <argument>${project.version}</argument>
                </arguments>
              </configuration>
            </execution>
            <execution>
              <id>npm copy css files over using version convention</id>
              <goals>
                <goal>exec</goal>
              </goals>
              <phase>prepare-package</phase>
              <configuration>
                <executable>npm</executable>
                <arguments>
                  <argument>run</argument>
                  <argument>prepackage-java</argument>
                </arguments>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <workingDirectory>${project.basedir}/../</workingDirectory>
          </configuration>
        </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
