<?xml version="1.0" encoding="UTF-8"?>
<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>
    
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <packaging>jar</packaging>
    <groupId>org.webjars</groupId>
    <artifactId>datatables-plugins</artifactId>
    <version>1.10.19</version>
    <name>DataTables Plugins</name>
    <description>WebJar for DataTables Plugins</description>
    <url>http://webjars.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <upstreamVersion>1.10.19</upstreamVersion>
        <upstreamSourceArchive>https://github.com/DataTables/Plugins/archive/${upstreamVersion}.zip</upstreamSourceArchive>
        <webjarResourceDir>META-INF/resources/webjars/${project.artifactId}/${project.version}</webjarResourceDir>
        <downloadDirectory>${project.build.directory}/generated-resources/maven-download-plugin</downloadDirectory>
        <requirejs>
            {
            }
        </requirejs>
    </properties>


    <licenses>
        <license>
            <name>MIT</name>
            <url>https://raw.githubusercontent.com/DataTables/Plugins/master/License.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>http://github.com/webjars/datatables-plugins</url>
        <connection>scm:git:https://github.com/webjars/datatables-plugins.git</connection>
        <developerConnection>scm:git:https://github.com/webjars/datatables-plugins.git</developerConnection>
        <tag>datatables-plugins-1.10.19</tag>
    </scm>

    <developers>
        <developer>
            <id>dgervalle</id>
            <name>Denis Gervalle</name>
            <email>dgl@softec.lu</email>
        </developer>
        <developer>
            <id>jamesward</id>
            <name>James Ward</name>
            <email>james@jamesward.org</email>
        </developer>
    </developers>
    
    <dependencies>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>datatables</artifactId>
            <version>${upstreamVersion}</version>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <!-- Download resources from upstream -->
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>get</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>${upstreamSourceArchive}</url>
                            <outputDirectory>${downloadDirectory}</outputDirectory>
                            <unpack>true</unpack>
                        </configuration>
                  </execution>
                </executions>
            </plugin>

            <!-- Copy resources to the build folder, to include them in the package -->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <includeEmptyDirs>true</includeEmptyDirs>
                            <resources>
                                <resource>
                                    <targetPath>${webjarResourceDir}</targetPath>
                                    <directory>${downloadDirectory}/Plugins-${upstreamVersion}</directory>
                                    <filtering>false</filtering>
                                </resource>
                          </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                      <phase>process-resources</phase>
                      <configuration>
                          <target>
                            <copy todir="${project.build.outputDirectory}">
                                <fileset dir="${project.build.outputDirectory}" />
                                <globmapper from="*.lang" to="*.json" />
                            </copy>                        
                            <replaceregexp replace="" flags="gs" byline="false" match="/\\*\\*(.*)\\*/">
                                <fileset dir="${project.build.outputDirectory}" includes="**/i18n/*.json" />
                            </replaceregexp>
                          </target>
                      </configuration>
                      <goals>
                          <goal>run</goal>
                      </goals>
                    </execution>
                </executions>
              </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.5</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>sonatype-nexus-staging</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
