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

  <parent>
    <groupId>com.cloudbees</groupId>
    <artifactId>groovy-cps-parent</artifactId>
    <version>1.21</version>
  </parent>

  <artifactId>groovy-cps</artifactId>

  <name>Groovy CPS Execution</name>

  <build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>properties</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <sourceRoot>${project.build.directory}/generated-sources/dgm</sourceRoot>
                        <executable>java</executable>
                        <arguments>
                            <argument>-jar</argument>
                            <argument>${com.cloudbees:groovy-cps-dgm-builder:jar:jar-with-dependencies}</argument>
                            <argument>${project.build.directory}/generated-sources/dgm</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.kohsuke</groupId>
            <artifactId>doxia-module-markdown</artifactId>
            <version>1.0</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <goals>
              <goal>testGenerateStubs</goal>
              <goal>testCompile</goal>
            </goals>
            <configuration>
                <!-- bad defaults, fixed in Jenkins patch of gmaven-plugin -->
                <stubsOutputDirectory>${project.build.directory}/generated-sources/groovy-stubs</stubsOutputDirectory>
                <testStubsOutputDirectory>${project.build.directory}/generated-test-sources/groovy-stubs</testStubsOutputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20</version>
        <configuration>
          <trimStackTrace>false</trimStackTrace> <!-- SUREFIRE-1226 workaround -->
        </configuration>
      </plugin>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
                <execution>
                    <id>test-jar</id>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>

  <properties>
      <groovy-sandbox.version>1.14</groovy-sandbox.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.cloudbees</groupId>
      <artifactId>groovy-cps-dgm-builder</artifactId>
      <version>${project.version}</version>
      <classifier>jar-with-dependencies</classifier>
      <scope>runtime</scope> <!-- somehow provide to dependency:properties without actually adding to CP -->
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.kohsuke</groupId>
      <artifactId>groovy-sandbox</artifactId>
      <version>${groovy-sandbox.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.kohsuke</groupId>
      <artifactId>groovy-sandbox</artifactId>
      <version>${groovy-sandbox.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>${groovy.version}</version>
      <!--
        let the user of this library select the right flavor of groovy,
        including groovy vs groovy-all
      -->
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-test</artifactId>
      <version>${groovy.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>11.0.1</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci</groupId>
      <artifactId>test-annotations</artifactId>
      <version>1.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

    <profiles>
        <profile>
            <id>cloudbees-oss-release</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-test-sources</id>
                                <goals>
                                    <goal>test-jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
