<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.webjars</groupId>
    <artifactId>webjars-parent</artifactId>
    <version>1</version>
    <packaging>pom</packaging>
    <url>http://webjars.org</url>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <properties>
        <destDir>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${upstream.version}</destDir>
    </properties>

    <developers>
        <developer>
            <id>jamesward</id>
            <name>James Ward</name>
            <url>http://www.jamesward.com</url>
            <email>james@jamesward.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/webjars/${project.artifactId}.git</connection>
        <developerConnection>scm:git:git@github.com:webjars/${project.artifactId}.git</developerConnection>
        <url>https://github.com/webjars/${project.artifactId}</url>
    </scm>

    <issueManagement>
        <system>github</system>
        <url>https://github.com/webjars/${project.artifactId}/issues</url>
    </issueManagement>

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

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>wagon-maven-plugin</artifactId>
                    <version>1.0-beta-4</version>
                    <executions>
                        <execution>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>download-single</goal>
                            </goals>
                            <configuration>
                                <url>${upstream.url}</url>
                                <fromFile>${upstream.zip.file}</fromFile>
                                <toFile>${project.build.directory}/${project.artifactId}.zip</toFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.7</version>
                    <executions>
                        <execution>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <target>
                                    <echo message="unzip archive" />
                                    <unzip src="${project.build.directory}/${project.artifactId}.zip" dest="${project.build.directory}" />
                                    <echo message="moving resources" />
                                    <move todir="${destDir}">
                                        <fileset dir="${project.build.directory}/${upstream.zip.folder}" />
                                    </move>
                                </target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <targetPath>${destDir}</targetPath>
            </resource>
        </resources>
        
    </build>
    
</project>