This is an automated email from the ASF dual-hosted git repository.
slachiewicz 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 9dee321 Add groovy-nio for java.nio.file.Path in hook scripts
9dee321 is described below
commit 9dee321649e089abf76a90ffd76219088f1b9dab
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 25 18:54:46 2026 +0000
Add groovy-nio for java.nio.file.Path in hook scripts
---
pom.xml | 5 ++
src/it/script-groovy-nio/pom.xml | 64 ++++++++++++++++++++++
src/it/script-groovy-nio/src/it/project/pom.xml | 32 +++++++++++
.../script-groovy-nio/src/it/project/verify.groovy | 32 +++++++++++
src/it/script-groovy-nio/verify.groovy | 25 +++++++++
src/site/markdown/groovy-version.md.vm | 2 +
6 files changed, 160 insertions(+)
diff --git a/pom.xml b/pom.xml
index 8cf4aad..8eed820 100644
--- a/pom.xml
+++ b/pom.xml
@@ -222,6 +222,11 @@ under the License.
<artifactId>groovy-xml</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.groovy</groupId>
+ <artifactId>groovy-nio</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
diff --git a/src/it/script-groovy-nio/pom.xml b/src/it/script-groovy-nio/pom.xml
new file mode 100644
index 0000000..29a1cb3
--- /dev/null
+++ b/src/it/script-groovy-nio/pom.xml
@@ -0,0 +1,64 @@
+<?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</groupId>
+ <artifactId>script-groovy-nio</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <description>
+ Test that hook scripts can use the Groovy extension methods for
java.nio.file.Path.
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/script-groovy-nio/src/it/project/pom.xml
b/src/it/script-groovy-nio/src/it/project/pom.xml
new file mode 100644
index 0000000..dfa58ed
--- /dev/null
+++ b/src/it/script-groovy-nio/src/it/project/pom.xml
@@ -0,0 +1,32 @@
+<?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>test</groupId>
+ <artifactId>project</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
diff --git a/src/it/script-groovy-nio/src/it/project/verify.groovy
b/src/it/script-groovy-nio/src/it/project/verify.groovy
new file mode 100644
index 0000000..46a1369
--- /dev/null
+++ b/src/it/script-groovy-nio/src/it/project/verify.groovy
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+import java.nio.file.Path
+
+// the extension methods used here come from groovy-nio
+Path dir = basedir.toPath()
+
+assert dir.resolve( 'pom.xml' ).text.contains(
'<artifactId>project</artifactId>' )
+
+Path result = dir.resolve( 'nio-result.txt' )
+result.text = 'text'
+result << '\nappended'
+assert result.readLines() == ['text', 'appended']
+
+return true
diff --git a/src/it/script-groovy-nio/verify.groovy
b/src/it/script-groovy-nio/verify.groovy
new file mode 100644
index 0000000..41e32c8
--- /dev/null
+++ b/src/it/script-groovy-nio/verify.groovy
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+// the inner project's hook script exercises the java.nio.file.Path extension
methods of groovy-nio
+File result = new File( basedir, "target/its/project/nio-result.txt" )
+assert result.exists() : "the post-build hook script did not run"
+assert result.readLines() == ['text', 'appended']
+
+return true
diff --git a/src/site/markdown/groovy-version.md.vm
b/src/site/markdown/groovy-version.md.vm
index c2094c8..d4158fc 100644
--- a/src/site/markdown/groovy-version.md.vm
+++ b/src/site/markdown/groovy-version.md.vm
@@ -25,6 +25,8 @@ runs on JDK 27. The plugin depends on these Groovy modules:
- `org.apache.groovy:groovy:${groovyVersion}`
- `org.apache.groovy:groovy-json:${groovyVersion}`
+- `org.apache.groovy:groovy-nio:${groovyVersion}`, since 3.11.0:
`java.nio.file.Path` extension methods such as
+ `path.text` and `path.readLines()`
- `org.apache.groovy:groovy-xml:${groovyVersion}`
If your scripts (`setup`, `prebuild`, `postbuild`, `selector`) need another
Groovy module, add it as a dependency of