<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Austrian Association for Software Tool Integration (AASTI)
    under one or more contributor license agreements. See the NOTICE file
    distributed with this work for additional information regarding copyright
    ownership. The AASTI licenses this file to you under the Apache License,
    Version 2.0 (the "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->

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

  <properties>
    <!-- base settings -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- plugin version -->
    <maven.plugin.checkstyle.version>2.6</maven.plugin.checkstyle.version>
    <!-- maven-notice-plugin -->
    <notice.template>https://github.com/openengsb/openengsb-framework/raw/master/etc/notice/NOTICE.template</notice.template>
  </properties>

  <parent>
    <groupId>org.openengsb</groupId>
    <artifactId>openengsb-root</artifactId>
    <version>27</version>
  </parent>

  <groupId>org.openengsb</groupId>
  <artifactId>openengsb-maven-plugin</artifactId>
  <version>2.3.0</version>
  <packaging>maven-plugin</packaging>

  <name>OpenEngSB Maven Plugin</name>

  <url>http://www.openengsb.org</url>

  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git://github.com/openengsb/openengsb-maven-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:openengsb/openengsb-maven-plugin.git</developerConnection>
    <url>http://github.com/openengsb/openengsb-maven-plugin</url>
  </scm>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>3.0.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>3.0.3</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.1</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.16</version>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.runner</groupId>
      <artifactId>pax-runner-platform</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.0.3</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>10.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.openengsb</groupId>
      <artifactId>openengsb-manual-builder-resources</artifactId>
      <version>1.0.0</version>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/manual</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <goalPrefix>openengsb</goalPrefix>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jasig.maven</groupId>
        <artifactId>maven-notice-plugin</artifactId>
        <configuration>
          <noticeTemplate>${notice.template}</noticeTemplate>
        </configuration>
      </plugin>
      <!--<plugin>
        <groupId>org.openengsb</groupId>
        <artifactId>openengsb-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generateDocSrc</id>
            <goals>
              <goal>extractSource</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <sourcePath>${project.basedir}/src/main/java</sourcePath>
              <targetPath>${project.basedir}/target/classes/docbook/snippets</targetPath>
            </configuration>
          </execution>
        </executions>
      </plugin>-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.openengsb</groupId>
                  <artifactId>openengsb-manual-builder-resources</artifactId>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/manual-resources</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.agilejava.docbkx</groupId>
        <artifactId>docbkx-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>html-single</id>
            <goals>
              <goal>generate-html</goal>
            </goals>
            <configuration>
              <xincludeSupported>true</xincludeSupported>
              <chunkedOutput>false</chunkedOutput>
              <htmlCustomization>${project.build.directory}/manual-resources/xsl/html.xsl</htmlCustomization>
              <preProcess>
                <delete dir="${basedir}/target/docbkx/html" />
              </preProcess>
              <postProcess>
                <copy todir="${basedir}/target/docbkx/html">
                  <fileset dir="${project.build.directory}/manual-resources">
                    <include name="**/*.css" />
                    <include name="**/*.png" />
                    <include name="**/*.gif" />
                    <include name="**/*.jpg" />
                  </fileset>
                </copy>
                <copy todir="${basedir}/target/docbkx/html/graphics" flatten="true">
                  <fileset dir="${project.build.directory}/classes">
                    <exclude name="resources/**" />
                    <include name="**/*.png" />
                    <include name="**/*.gif" />
                    <include name="**/*.jpg" />
                  </fileset>
                </copy>
                <copy todir="${basedir}/target/manual/html-single">
                  <fileset dir="${basedir}/target/docbkx/html">
                    <include name="**/*" />
                  </fileset>
                </copy>
              </postProcess>
            </configuration>
            <phase>compile</phase>
          </execution>
          <execution>
            <id>html-multi</id>
            <goals>
              <goal>generate-html</goal>
            </goals>
            <configuration>
              <xincludeSupported>true</xincludeSupported>
              <chunkedOutput>true</chunkedOutput>
              <htmlCustomization>${project.build.directory}/manual-resources/xsl/html_chunk.xsl</htmlCustomization>
              <preProcess>
                <delete dir="${basedir}/target/docbkx/html" />
              </preProcess>
              <postProcess>
                <copy todir="${basedir}/target/docbkx/html">
                  <fileset dir="${project.build.directory}/manual-resources">
                    <include name="**/*.css" />
                    <include name="**/*.png" />
                    <include name="**/*.gif" />
                    <include name="**/*.jpg" />
                  </fileset>
                </copy>
                <copy todir="${basedir}/target/docbkx/html/graphics" flatten="true">
                  <fileset dir="${project.build.directory}/classes/">
                    <exclude name="resources/**" />
                    <include name="**/*.png" />
                    <include name="**/*.gif" />
                    <include name="**/*.jpg" />
                  </fileset>
                </copy>
                <copy todir="${basedir}/target/manual/html-multi">
                  <fileset dir="${basedir}/target/docbkx/html">
                    <include name="*/**" />
                  </fileset>
                </copy>
                <copy todir="${basedir}/target/manual/html-multi">
                  <fileset dir="${basedir}/target/docbkx/html/${project.artifactId}">
                    <include name="**/*" />
                  </fileset>
                </copy>
              </postProcess>
            </configuration>
            <phase>compile</phase>
          </execution>
          <execution>
            <id>pdf-single</id>
            <goals>
              <goal>generate-pdf</goal>
            </goals>
            <configuration>
              <xincludeSupported>true</xincludeSupported>
              <foCustomization>${project.build.directory}/manual-resources/xsl/fopdf.xsl</foCustomization>
              <imgSrcPath>file:///${basedir}/target/classes/</imgSrcPath>
              <postProcess>
                <copy todir="${basedir}/target/manual/pdf">
                  <fileset dir="${basedir}/target/docbkx/pdf">
                    <include name="**/*.pdf" />
                  </fileset>
                </copy>
              </postProcess>
            </configuration>
            <phase>compile</phase>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>net.sf.docbook</groupId>
            <artifactId>docbook-xml</artifactId>
            <version>${docbkx.xml.version}</version>
            <scope>runtime</scope>
            <classifier>resources</classifier>
            <type>zip</type>
          </dependency>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>jai_core</artifactId>
            <version>${jai.version}</version>
            <scope>runtime</scope>
          </dependency>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>jai_codec</artifactId>
            <version>${jai.version}</version>
            <scope>runtime</scope>
          </dependency>
        </dependencies>
        <configuration>
          <includes>*.xml</includes>
          <htmlStylesheet>css/html.css</htmlStylesheet>
          <xincludeSupported>true</xincludeSupported>
          <sourceDirectory>${basedir}/target/classes</sourceDirectory>
          <!--<generatedSourceDirectory>${basedir}/target/classes</generatedSourceDirectory>-->
          <useExtensions>1</useExtensions>
          <highlightSource>1</highlightSource>
          <highlightDefaultLanguage />
          <calloutsExtension>1</calloutsExtension>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>${project.basedir}/src/descriptors/src.xml</descriptor>
            <descriptor>${project.basedir}/src/descriptors/docbook.xml</descriptor>
            <descriptor>${project.basedir}/src/descriptors/manual.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>make-src-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>wagon-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>upload-manual</id>
            <phase>deploy</phase>
            <goals>
              <goal>upload</goal>
            </goals>
            <configuration>
              <fromDir>${basedir}/target/manual/</fromDir>
              <includes>*/**</includes>
              <url>scp://openengsb.org/</url>
              <toDir>var/www/openengsb/manual/${project.artifactId}/v${project.version}/</toDir>
              <serverId>OpenengsbWebServer</serverId>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

