<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>org.alfresco</groupId>
    <artifactId>api-explorer</artifactId>
    <version>6.1.0</version>
    <packaging>war</packaging>
    <name>Alfresco REST API Explorer</name>
    <description>Produces the API Explorer for all API definitions</description>
    <properties>
      <swagger-ui.version>2.1.4</swagger-ui.version>
      <maven.compiler.source>1.7</maven.compiler.source>
      <maven.compiler.target>1.7</maven.compiler.target>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    <scm>
      <connection>scm:git:https://github.com/Alfresco/rest-api-explorer.git</connection>
      <developerConnection>scm:git:https://github.com/Alfresco/rest-api-explorer.git</developerConnection>
      <url>https://github.com/Alfresco/rest-api-explorer</url>
      <tag>6.1.0</tag>
  </scm>
    <licenses>
      <license>
         <name>Apache License 2.0</name>
         <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      </license>
   </licenses>
    <dependencies>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>swagger-ui</artifactId>
            <version>${swagger-ui.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-parser</artifactId>
            <version>1.0.19</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>api-explorer</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
            <!-- skip unit tests as the project only contains integration tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includes>META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/**/*.*</includes>
                            <excludes>**/index.html,**/*.gz</excludes>
                            <outputDirectory>${basedir}/src/main/swagger</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <id>generate-json</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>org.alfresco.api.YamlToJson</mainClass>
                    <arguments>
                        <argument>${basedir}</argument>
                    </arguments>
                    <classpathScope>test</classpathScope>
                </configuration>
            </plugin>
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
              <filesets>
                <fileset>
                  <directory>${basedir}/src/main/swagger</directory>
                </fileset>
              </filesets>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
              <webResources>
                <resource>
                  <directory>src/main/swagger/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}</directory>
                </resource>
              </webResources>
                <archive>
                  <manifestEntries>
                    <Implementation-Version>${project.version}</Implementation-Version>
                    <Build-Date>${maven.build.timestamp}</Build-Date>
                    <Build-Name>${bamboo_planName}</Build-Name>
                    <Build-Key>${bamboo_fullBuildKey}</Build-Key>
                    <Build-Number>${bamboo_buildNumber}</Build-Number>
                    <Build-Revision>${bamboo_repository_revision_number}</Build-Revision>
                  </manifestEntries>
                  <manifestSections>
                    <manifestSection>
                        <name>Libraries</name>
                        <manifestEntries>
                            <swaggerui-version>${swagger-ui.version}</swaggerui-version>
                        </manifestEntries>
                    </manifestSection>
                  </manifestSections>
                  <manifest>
                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                  </manifest>
                </archive>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
               <execution>
                  <id>run-war-only</id>
                  <goals>
                     <goal>run-war-only</goal>
                  </goals>
                  <phase>pre-integration-test</phase>
                  <configuration>
                     <fork>true</fork>
                  </configuration>
               </execution>
            </executions>
            <configuration>
                <port>8085</port>
            </configuration>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <version>2.18.1</version>
              <executions>
                  <execution>
                      <id>integration-tests</id>
                      <goals>
                          <goal>integration-test</goal>
                          <goal>verify</goal>
                      </goals>
                      <configuration>
                          <includes>
                              <include>**/*IntegrationTest.java</include>
                          </includes>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <repository>
            <id>alfresco-releases</id>
            <url>https://artifacts.alfresco.com/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <id>alfresco-snapshots</id>
            <url>https://artifacts.alfresco.com/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
</project>
