选择器脚本
从插件版本 1.5 开始,自定义脚本可用于根据脚本中表达的任何标准跳过单个项目,如下例所示。假设以下目录结构:
./ +- pom.xml +- src/ +- it/ +- settings.xml +- conditional-it/ +- pom.xml +- check-assumptions.bsh +- src/
此示例的插件配置如下所示:
<project> ... <build> <plugins> <plugin> <artifactId>maven-invoker-plugin</artifactId> <version>3.2.2</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>
如果 check-assumptions.bsh 脚本返回true
或不返回值,则项目将被执行。
如果脚本返回 以外的任何值true
,则不会执行项目。
如果脚本抛出异常,则项目将被标记为 ERROR。