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

    Copyright (c) 2012-2016 Codenvy, S.A.
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v1.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v10.html

    Contributors:
      Codenvy, S.A. - initial API and implementation

-->
<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>
        <artifactId>everrest-parent</artifactId>
        <groupId>org.everrest</groupId>
        <version>1.13.5</version>
    </parent>
    <artifactId>everrest-groovy</artifactId>
    <name>EverRest :: Groovy</name>
    <properties>
        <argLine>-Djava.security.manager=default -Djava.security.policy=${project.build.directory}/test-classes/test.policy
            -Djava.security.debug=denied</argLine>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.everrest</groupId>
            <artifactId>everrest-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-test-policy</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks unless="maven.test.skip">
                                <echo>***** Creating Access Policy for tests *****</echo>
                                <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
                                <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
                                <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
                                <makeurl file="${project.build.directory}/../../" property="parentDirectoryURL" />
                                <!-- <echo>***** ${parentDirectory}</echo> -->
                                <copy overwrite="true" todir="${project.build.testOutputDirectory}">
                                    <fileset dir="${project.basedir}/src/test/resources/">
                                        <include name="test.policy" />
                                    </fileset>
                                    <filterset>
                                        <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
                                        <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
                                        <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
                                        <filter token="PARENT" value="${parentDirectoryURL}" />
                                    </filterset>
                                </copy>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
