Selector Scripts

Starting with plugin version 1.5, a custom script can be used to skip individual projects based on whatever criteria expressed in the script as illustrated in the following example. Assume the following directory structure:

./
+- pom.xml
+- src/
   +- it/
      +- settings.xml
      +- conditional-it/
         +- pom.xml
         +- check-assumptions.bsh
         +- src/

The plugin configuration for this example would look like this:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <projectsDirectory>src/it</projectsDirectory>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <pomIncludes>
            <pomInclude>*/pom.xml</pomInclude>
          </pomIncludes>
          <settingsFile>src/it/settings.xml</settingsFile>
          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
          <selectorScript>check-assumptions.bsh</selectorScript>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>

If the check-assumptions.bsh script returns true or does not return a value, then the project will be executed.

If the script returns any value other than true, then the project will not be executed.

If the script throws an exception, then the project will be marked as being in ERROR.