Grails Maven Plugin

Allow users to add extra Grails commands to Maven phases

Details

  • Type: Sub-task Sub-task
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Come up with a way to add things Grails commands like "run-webtest" to particular phases. The main reason for this is so that users can attach either WebTest or Selenium (or some other) tests to the "intg-test" phase.

Activity

Hide
Peter Ledbrook added a comment -

Maybe it's possible to bind a goal with a particular configuration to a phase? In which case, we could use the "grails:exec" goal.

Show
Peter Ledbrook added a comment - Maybe it's possible to bind a goal with a particular configuration to a phase? In which case, we could use the "grails:exec" goal.
Hide
Peter Ledbrook added a comment -

In fact, this is already possible. Say you want to use the Functional Test plugin for your app. You start by installing it:

mvn grails:install-plugin -DpluginName="functional-test"

You write your tests, da-di-da, and then you need to run them. First port of call is the POM: add a "functional-tests" execution block to the plugin (you can name the execution anything):

<plugin>
        <groupId>org.grails</groupId>
        <artifactId>grails-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
            ...
            </goals>
          </execution>
          <execution>
            <id>functional-tests</id>
            <phase>integration-test</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <command>functional-tests</command>
            </configuration>
          </execution>
        </executions>
      </plugin>

What we have done here is tie the "grails:exec" goal to the "integration-test" phase, and configured the goal to run the "functional-tests" Grails command. Now all you have to do is:

mvn integration-test

and marvel at the fact it works!

Show
Peter Ledbrook added a comment - In fact, this is already possible. Say you want to use the Functional Test plugin for your app. You start by installing it:
mvn grails:install-plugin -DpluginName="functional-test"
You write your tests, da-di-da, and then you need to run them. First port of call is the POM: add a "functional-tests" execution block to the plugin (you can name the execution anything):
<plugin>
        <groupId>org.grails</groupId>
        <artifactId>grails-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
            ...
            </goals>
          </execution>
          <execution>
            <id>functional-tests</id>
            <phase>integration-test</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <command>functional-tests</command>
            </configuration>
          </execution>
        </executions>
      </plugin>
What we have done here is tie the "grails:exec" goal to the "integration-test" phase, and configured the goal to run the "functional-tests" Grails command. Now all you have to do is:
mvn integration-test
and marvel at the fact it works!
Hide
Peter Ledbrook added a comment -

Already works baby!

Show
Peter Ledbrook added a comment - Already works baby!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: