This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 89b9633 [MINVOKER-365] Allow to pre-build script to set user
properties
89b9633 is described below
commit 89b9633c3d811275573633ace560f89107a9decb
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Sat May 4 16:43:56 2024 +0200
[MINVOKER-365] Allow to pre-build script to set user properties
---
.../pom.xml | 65 +++++++++
.../src/it/project/pom.xml | 60 ++++++++
.../src/it/project/postbuild.groovy | 22 +++
.../src/it/project/prebuild.groovy | 26 ++++
.../verify.groovy | 29 ++++
.../maven/plugins/invoker/AbstractInvokerMojo.java | 53 +++++---
src/site/apt/examples/post-build-script.apt.vm | 97 -------------
src/site/apt/examples/pre-post-build-script.apt.vm | 151 +++++++++++++++++++++
src/site/apt/examples/selector-scripts.apt.vm | 5 +-
src/site/apt/groovy-version.apt.vm | 2 +-
src/site/apt/index.apt.vm | 2 +-
src/site/apt/usage.apt.vm | 2 +-
src/site/site.xml | 2 +-
13 files changed, 394 insertions(+), 122 deletions(-)
diff --git a/src/it/MINVOKER-365-user-poperties-from-pre-build/pom.xml
b/src/it/MINVOKER-365-user-poperties-from-pre-build/pom.xml
new file mode 100644
index 0000000..044b2f8
--- /dev/null
+++ b/src/it/MINVOKER-365-user-poperties-from-pre-build/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<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>
+
+ <groupId>org.apache.maven.plugins.invoker.its</groupId>
+ <artifactId>minvoker-335</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <description>
+ Test to check a user properties generated by pre-build
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
<version.maven-enforcer-plugin>@version.maven-enforcer-plugin@</version.maven-enforcer-plugin>
+
<version.maven-clean-plugin>@version.maven-clean-plugin@</version.maven-clean-plugin>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <goals>
+ <goal>clean</goal>
+ <goal>initialize</goal>
+ </goals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/pom.xml
b/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/pom.xml
new file mode 100644
index 0000000..02d6e99
--- /dev/null
+++ b/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<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>
+ <groupId>org.apache.maven.plugins.invoker.its</groupId>
+ <artifactId>minvoker-365</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>@version.maven-clean-plugin@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>@version.maven-enforcer-plugin@</version>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <rules>
+ <requireFilesExist>
+ <files>
+ <file>${testFile}</file>
+ </files>
+ </requireFilesExist>
+ </rules>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/postbuild.groovy
b/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/postbuild.groovy
new file mode 100644
index 0000000..6491a73
--- /dev/null
+++
b/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/postbuild.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def logs = new File(basedir, 'build.log').text
+
+assert logs.contains('[INFO] Clean is skipped.')
diff --git
a/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/prebuild.groovy
b/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/prebuild.groovy
new file mode 100644
index 0000000..ebb19e0
--- /dev/null
+++
b/src/it/MINVOKER-365-user-poperties-from-pre-build/src/it/project/prebuild.groovy
@@ -0,0 +1,26 @@
+import java.nio.file.Files
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def userProperties = context.get('userProperties')
+
+def testFilePath = Files.createTempFile('minvoker-365-prefix', 'suffix')
+userProperties.put('testFile', testFilePath.toString())
+userProperties.put('maven.clean.skip', 'true')
diff --git a/src/it/MINVOKER-365-user-poperties-from-pre-build/verify.groovy
b/src/it/MINVOKER-365-user-poperties-from-pre-build/verify.groovy
new file mode 100644
index 0000000..e82ee9a
--- /dev/null
+++ b/src/it/MINVOKER-365-user-poperties-from-pre-build/verify.groovy
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def logs = new File(basedir, 'build.log').text
+
+// check if properties are pass to execution
+if
(System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")) {
+ assert logs.contains("-D testFile=")
+ assert logs.contains("-D maven.clean.skip=true")
+} else {
+ assert logs.contains("'-D' 'testFile=")
+ assert logs.contains("'-D' 'maven.clean.skip=true'")
+}
diff --git
a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index 09987f4..78b2d30 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -1838,24 +1838,15 @@ public abstract class AbstractInvokerMojo extends
AbstractMojo {
}
Map<String, Object> context = new LinkedHashMap<>();
+ Properties scriptUserProperties = new Properties();
+ context.put("userProperties", scriptUserProperties);
- boolean selectorResult = true;
+ if (!runSelectorHook(basedir, context, logger)) {
+ return false;
+ }
try {
- try {
- scriptRunner.run("selector script", basedir, selectorScript,
context, logger);
- } catch (ScriptReturnException e) {
- selectorResult = false;
- return false;
- } catch (ScriptException e) {
- throw new RunFailureException(BuildJob.Result.ERROR, e);
- }
-
- try {
- scriptRunner.run("pre-build script", basedir,
preBuildHookScript, context, logger);
- } catch (ScriptException e) {
- throw new
RunFailureException(BuildJob.Result.FAILURE_PRE_HOOK, e);
- }
+ runPreBuildHook(basedir, context, logger);
for (int invocationIndex = 1; ; invocationIndex++) {
if (invocationIndex > 1 &&
!invokerProperties.isInvocationDefined(invocationIndex)) {
@@ -1889,6 +1880,7 @@ public abstract class AbstractInvokerMojo extends
AbstractMojo {
Properties userProperties =
getUserProperties(basedir,
invokerProperties.getUserPropertiesFile(invocationIndex));
+ userProperties.putAll(scriptUserProperties);
request.setProperties(userProperties);
invokerProperties.configureInvocation(request,
invocationIndex);
@@ -1911,12 +1903,8 @@ public abstract class AbstractInvokerMojo extends
AbstractMojo {
"Maven invocation failed. " + e.getMessage(),
BuildJob.Result.FAILURE_BUILD);
}
}
- } catch (IOException e) {
- throw new MojoExecutionException(e.getMessage(), e);
} finally {
- if (selectorResult) {
- runPostBuildHook(basedir, context, logger);
- }
+ runPostBuildHook(basedir, context, logger);
}
return true;
}
@@ -1931,6 +1919,31 @@ public abstract class AbstractInvokerMojo extends
AbstractMojo {
}
}
+ private boolean runSelectorHook(File basedir, Map<String, Object> context,
FileLogger logger)
+ throws MojoExecutionException, RunFailureException {
+ try {
+ scriptRunner.run("selector script", basedir, selectorScript,
context, logger);
+ } catch (ScriptReturnException e) {
+ return false;
+ } catch (ScriptException e) {
+ throw new RunFailureException(BuildJob.Result.ERROR, e);
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ return true;
+ }
+
+ private void runPreBuildHook(File basedir, Map<String, Object> context,
FileLogger logger)
+ throws MojoExecutionException, RunFailureException {
+ try {
+ scriptRunner.run("pre-build script", basedir, preBuildHookScript,
context, logger);
+ } catch (ScriptException e) {
+ throw new RunFailureException(BuildJob.Result.FAILURE_PRE_HOOK, e);
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
private void runPostBuildHook(File basedir, Map<String, Object> context,
FileLogger logger)
throws MojoExecutionException, RunFailureException {
try {
diff --git a/src/site/apt/examples/post-build-script.apt.vm
b/src/site/apt/examples/post-build-script.apt.vm
deleted file mode 100644
index 93c15a8..0000000
--- a/src/site/apt/examples/post-build-script.apt.vm
+++ /dev/null
@@ -1,97 +0,0 @@
- ------
- Using a Post-Build Script
- ------
- Paul Gier
- ------
- 2008-08-02
- ------
-
- ~~ Licensed to the Apache Software Foundation (ASF) under one
- ~~ or more contributor license agreements. See the NOTICE file
- ~~ distributed with this work for additional information
- ~~ regarding copyright ownership. The ASF licenses this file
- ~~ to you under the Apache License, Version 2.0 (the
- ~~ "License"); you may not use this file except in compliance
- ~~ with the License. You may obtain a copy of the License at
- ~~
- ~~ http://www.apache.org/licenses/LICENSE-2.0
- ~~
- ~~ Unless required by applicable law or agreed to in writing,
- ~~ software distributed under the License is distributed on an
- ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~~ KIND, either express or implied. See the License for the
- ~~ specific language governing permissions and limitations
- ~~ under the License.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Using a Post-Build Script
-
- Here is an example of how the Invoker Plugin can be used to run a set of
Maven projects and then verify their output
- with a {{{http://www.beanshell.org/}BeanShell}} or
{{{http://groovy-lang.org/}Groovy}} script. The name of the
- script file in this case is <<<verify.bsh>>>.
-
-+------------------
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-invoker-plugin</artifactId>
- <version>${project.version}</version>
- <configuration>
- <debug>true</debug>
- <projectsDirectory>src/it</projectsDirectory>
- <preBuildHookScript>setup.bsh</preBuildHookScript>
- <postBuildHookScript>verify.bsh</postBuildHookScript>
- </configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
-+------------------
-
- Below is an example post-build BeanShell script (<<<verify.bsh>>>) that
checks for the existence of a JAR file after
- the build has run. If the JAR file does not exist, the script throws an
exception which causes the Invoker Plugin to
- log that the build failed. More precisely, any non-null return value which
does not equal <<<true>>> will be interpreted
- as a failure condition. And of course, if the script exits abnormally due to
an exception, the plugin will flag the
- corresponding build as a failure, too.
-
-+------------------
-import java.io.*;
-
-File file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" );
-if ( !file.isFile() )
-{
- throw new FileNotFoundException( "Could not find generated JAR: " + file );
-}
-+------------------
-
- Complementary to the post-build hook script, you can also create a pre-build
hook script that will be run before
- the invocation of Maven. This can be used to do some preparations for the
build.
-
- To allow the scripts to access some useful data about the test project, the
following global variables will be
- defined by the Invoker Plugin before running the script:
-
-*--------------------------+----------------------+-----------------------------------------------------------+--------+
-|| Name || Type || Description
|| Since |
-*--------------------------+----------------------+-----------------------------------------------------------+--------+
-| <<<basedir>>> | <<<java.io.File>>> | The absolute path to the
base directory of the test project. | 1.0 |
-*--------------------------+----------------------+-----------------------------------------------------------+--------+
-| <<<localRepositoryPath>>>| <<<java.io.File>>> | The absolute path to the
local repository used for the Maven invocation on the test project. | 1.3 |
-*--------------------------+----------------------+-----------------------------------------------------------+--------+
-| <<<context>>> | <<<java.util.Map>>> | The storage of key-value
pairs used to pass data from the pre-build hook script to the post-build hook
script. | 1.4 |
-*--------------------------+----------------------+-----------------------------------------------------------+--------+
-| <<<mavenVersion>>> | <<<java.lang.String>>> | The version of Maven
executing on the test project. | 1.9 |
-*--------------------------+----------------------+-----------------------------------------------------------+--------+
-
- Additional variables that can be accessed in the hook scripts can be defined
through the
- <<<{{{../run-mojo.html#scriptVariables}scriptVariables}}>>> parameter in the
Invoker Plugin's configuration.
\ No newline at end of file
diff --git a/src/site/apt/examples/pre-post-build-script.apt.vm
b/src/site/apt/examples/pre-post-build-script.apt.vm
new file mode 100644
index 0000000..8a8e094
--- /dev/null
+++ b/src/site/apt/examples/pre-post-build-script.apt.vm
@@ -0,0 +1,151 @@
+ ------
+ Using Pre and Post Build Script
+ ------
+ Paul Gier
+ ------
+ 2008-08-02
+ ------
+
+ ~~ Licensed to the Apache Software Foundation (ASF) under one
+ ~~ or more contributor license agreements. See the NOTICE file
+ ~~ distributed with this work for additional information
+ ~~ regarding copyright ownership. The ASF licenses this file
+ ~~ to you under the Apache License, Version 2.0 (the
+ ~~ "License"); you may not use this file except in compliance
+ ~~ with the License. You may obtain a copy of the License at
+ ~~
+ ~~ http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing,
+ ~~ software distributed under the License is distributed on an
+ ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~~ KIND, either express or implied. See the License for the
+ ~~ specific language governing permissions and limitations
+ ~~ under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Using a Pre-Build Script
+
+ Complementary to the post-build hook script, you can also create a pre-build
hook script that will be run before
+ the invocation of Maven. This can be used to do some preparations for the
build.
+
+ Default name of Pre-Build script is <<<prebuild>>>, you can use name
<<<prebuild.bsh>>> or <<<prebuild.groovy>>>
+ according to chosen script language.
+
+ In Pre-Build scripts you can prepare a test resources for your project.
+
+ You can also define a user properties which will be added to executed test
project by <<<-D>>> Maven argument.
+
+ Here is an example of groovy script:
+
++------------------
+def userProperties = context.get('userProperties')
+
+def server = new MockServer()
+userProperties.put('serverHost', server.getHost())
+userProperties.put('serverPort', server.getPort())
++------------------
+
+ Now you can use it in test project:
+
++------------------
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.example</groupId>
+ <artifactId>my-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <server>${serverHost}:${serverPort}</server>
+ </configuration>
+ <executions>
+ ....
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
++------------------
+
+Using a Post-Build Script
+
+ Here is an example of how the Invoker Plugin can be used to run a set of
Maven projects and then verify their output
+ with a {{{https://beanshell.github.io/}BeanShell}} or
{{{https://groovy-lang.org/}Groovy}} script. The name of the
+ script file in this case is <<<verify>>> - default value is <<<postbuild>>>.
+
++------------------
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <preBuildHookScript>setup</preBuildHookScript>
+ <postBuildHookScript>verify</postBuildHookScript>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
++------------------
+
+ Below is an example post-build BeanShell script (<<<verify.bsh>>>) that
checks for the existence of a JAR file after
+ the build has run. If the JAR file does not exist, the script throws an
exception which causes the Invoker Plugin to
+ log that the build failed. More precisely, any non-null return value which
does not equal <<<true>>> will be interpreted
+ as a failure condition. And of course, if the script exits abnormally due to
an exception, the plugin will flag the
+ corresponding build as a failure, too.
+
+ Example <<<verify.bsh>>>
+
++------------------
+import java.io.*;
+
+File file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" );
+if ( !file.isFile() )
+{
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
++------------------
+
+ and similar <<<verify.groovy>>>
+
++------------------
+def file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" )
+assert file.isFile()
++------------------
+
+Predefined global variables
+
+ To allow the scripts to access some useful data about the test project, the
following global variables will be
+ defined by the Invoker Plugin before running the script:
+
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+|| Name || Type ||
Description || Since |
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+| <<<basedir>>> | <<<java.io.File>>> | The
absolute path to the base directory of the test project. | 1.0 |
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+| <<<localRepositoryPath>>> | <<<java.io.File>>> | The
absolute path to the local repository used for the Maven invocation on the test
project. | 1.3 |
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+| <<<context>>> | <<<java.util.Map>>> | The
storage of key-value pairs used to pass data from the pre-build hook script to
the post-build hook script. | 1.4 |
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+| <<<context.get('userProperties')>>> | <<<java.util.Properties>>> | The user
properties for executing project | 3.7.0 |
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+| <<<mavenVersion>>> | <<<java.lang.String>>> | The
version of Maven executing on the test project. | 1.9 |
+*-------------------------------------+----------------------------+-----------------------------------------------------------+--------+
+
+ Additional variables that can be accessed in the hook scripts can be defined
through the
+ <<<{{{../run-mojo.html#scriptVariables}scriptVariables}}>>> parameter in the
Invoker Plugin's configuration.
diff --git a/src/site/apt/examples/selector-scripts.apt.vm
b/src/site/apt/examples/selector-scripts.apt.vm
index 43072df..806a222 100644
--- a/src/site/apt/examples/selector-scripts.apt.vm
+++ b/src/site/apt/examples/selector-scripts.apt.vm
@@ -85,4 +85,7 @@ Selector Scripts
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.
-
+
+Predefined global variables
+
+ In Selector Scripts the same global variables are defined as in
{{{./pre-post-build-script.html#predefined-global-variables}Pre and Post Build
Script}}
diff --git a/src/site/apt/groovy-version.apt.vm
b/src/site/apt/groovy-version.apt.vm
index bc1d17f..76a1aad 100644
--- a/src/site/apt/groovy-version.apt.vm
+++ b/src/site/apt/groovy-version.apt.vm
@@ -56,7 +56,7 @@ Groovy version and extensions
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-yaml</artifactId>
- <version>3.0.10</version>
+ <version>${groovy-version}</version>
</dependency>
</dependencies>
</plugin>
diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm
index a05187c..bcb7e57 100644
--- a/src/site/apt/index.apt.vm
+++ b/src/site/apt/index.apt.vm
@@ -98,7 +98,7 @@ ${project.name}
* {{{./examples/install-artifacts.html}Install}} projects artifacts to a
local repository before running.
- * {{{./examples/post-build-script.html}Run a BeanShell or Groovy script}} to
verify project output.
+ * {{{./examples/pre-post-build-script.html}Run a BeanShell or Groovy
script}} to prepare or verify project.
* {{{./examples/fast-use.html}Fast Invoker Plugin configuration}} to
accelerate project execution.
diff --git a/src/site/apt/usage.apt.vm b/src/site/apt/usage.apt.vm
index 8269569..7562d05 100644
--- a/src/site/apt/usage.apt.vm
+++ b/src/site/apt/usage.apt.vm
@@ -122,7 +122,7 @@ Usage
When an integration test has finished, the plugin will invoke an optional
post build hook script. In the example,
this is the case for <<<second-it>>> where <<<verify.bsh>>> will be run. The
purpose of this script is usually to
check that the build of the integration test did not only succeed but also
produced the intended output. Have a look
- at the example {{{./examples/post-build-script.html}Using a Post Build
Script}} for a code snippet.
+ at the example {{{./examples/pre-post-build-script.html}Using Pre and Post
Build Script}} for a code snippet.
* Running Only Some Tests
diff --git a/src/site/site.xml b/src/site/site.xml
index 1b34bc6..a0932f7 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -48,7 +48,7 @@ under the License.
<item name="Inspect logs for failed tests"
href="examples/logs-for-failed-tests.html"/>
<item name="Selector Conditions"
href="examples/selector-conditions.html"/>
<item name="Selector Scripts" href="examples/selector-scripts.html"/>
- <item name="Using a Post Build Script"
href="examples/post-build-script.html"/>
+ <item name="Using Pre and Post Build Script"
href="examples/pre-post-build-script.html"/>
<item name="Parallel projects execution"
href="examples/parallel-projects-execution.html"/>
<item name="Preparing the Build Environment"
href="examples/prepare-build-env.html"/>
<item name="Skipping Invocations" href="examples/skipping.html"/>