slachiewicz opened a new issue, #811:
URL: https://github.com/apache/maven-invoker-plugin/issues/811
Most `apache/maven-*` repositories carry maven-invoker-plugin hook scripts
(`verify.groovy`, `setup.groovy`, ...) written in an older style: catch-all
`try`/`catch` wrappers that print a stack trace and `return false`, `if (!x) {
println ...; return false }` checks, `boolean result` accumulators, and
plexus-utils helpers such as `FileUtils.fileRead`. About 240 scripts in 27
repositories still use `return false`, and about 120 scripts in 23 repositories
import `org.codehaus.plexus.util`.
The scripts run on the Groovy bundled with this plugin (Groovy 4 for 3.x),
whatever Java version the project targets. That plexus-utils resolves in them
at all depends on this plugin's own dependency on it.
This issue tracks one draft PR per repository that rewrites them at the
Groovy 4 level:
- Wrapper and `return false` checks become `assert` statements, so failures
report the expression and its values. Failures now stop at the first failing
assertion.
- `FileUtils.fileRead(f)` becomes `f.getText('UTF-8')` (not `f.text`, which
uses the platform charset), and `FileUtils.deleteDirectory(d)` becomes `assert
d.deleteDir()` outside symlink ITs. Helpers without an exact Groovy equivalent
stay.
- Default imports (`java.io.*`, `java.util.*`, `java.net.*`) and unused
imports are removed.
Out of scope: `selector.groovy` scripts (their `return false` means "skip"),
fixture scripts that test the script runner itself, BeanShell scripts, `-4.x`
branches, and `java.nio.file.Path` extension methods, which need groovy-nio
(#809) in a released invoker.
PRs:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]