slachiewicz opened a new pull request, #66:
URL: https://github.com/apache/maven-executor/pull/66
**Stacked on #65** (A7, plugin-free paths): this PR targets its branch, so
the diff shows only the new module; it retargets to `main` once #65 is merged.
Seven IT suites that moved off maven-verifier (sources table in #49) each
wrote about 2,100 lines of the same Verifier helpers, and review of
apache/maven-integration-testing#446 asked for them in one place instead. This
is T1 in #49: a `maven-executor-verifier` module, Java 8, depending on
`maven-executor` only.
**`Verifier`**, seeded from apache/maven-integration-testing#446:
- `execute()` runs Maven in the base directory with `-e --batch-mode`,
`-Dmaven.repo.local`, `maven-clean-plugin:clean` first unless
`setAutoclean(false)`, the system properties as `-D` and then the arguments;
stdout and stderr go to the log file (`log.txt`, `setLogFileName`). A non-zero
exit throws `VerificationException` with the command line and the log.
- Maven is the installation in `maven.home`, in the mode of
`verifier.forkMode` (forked when unset), with one shared `ExecutorHelper` per
installation for the life of the JVM; or any `ExecutorHelper` given to the
constructor.
- Log checks: `verifyErrorFreeLog` (an `[ERROR]` scan that ignores old
Doxia's Velocity noise), `verifyTextInLog`, and the new `verifyTextNotInLog`,
all ignoring ANSI colours.
- File checks: `verifyFilePresent`/`NotPresent` with `*` patterns and
`a.jar!/entry`; `loadLines`, `loadProperties`, `loadFile` with `${artifact:…}`
markers, `filterFile`, `newDefaultFilterMap`.
- Local repository: `getLocalRepository`, `getArtifactPath`,
`getArtifactMetadataPath`, `verifyArtifact*`, `deleteArtifact(s)`. Paths come
from an `ExecutorTool`, `DefaultExecutorTool` from #65 by default, so no plugin
is resolved. Packaging types that are stored under another extension
(`maven-plugin`, `test-jar`, `ejb-client`, …) are mapped; a suite adds its own
by overriding `extensionAndClassifier` (the core ITs' `coreit-artifact`, for
example).
- `addCliArgument` adds one argument as is; the new `addCliOption("-pl x
-am")` splits on whitespace like maven-verifier 1.x.
apache/maven-build-cache-extension#536 failed on exactly that.
**Left out on purpose**, per review of #446: the members kept there only for
source compatibility with maven-verifier: `Verifier(String, boolean)`,
`displayStreamBuffers()`, `setCliOptions(List)`, `filterFile(…, Properties)`,
`getLocalRepoLayout()` and the `USER_HOME` constants. Consumers migrate those
call sites. maven-shared-utils is replaced by the JDK.
**`ResourceExtractor`**: same API, without maven-shared-utils. It fixes a
bug in the seed: the `ZipFile` was closed inside the loop after the first file,
so extracting a test project with more than one file from a jar failed. A
relative resource path now resolves against the class's package, and a jar
entry can't escape the target directory.
Behaviour differences from the seed: `verifyArtifactNotPresent` checks the
artifact file only (the seed also failed when metadata next to it existed), and
`${artifact:…}` markers list the metadata of the version and artifact
directories for lines with and without a command alike.
Tests (all pass; `mvn verify` passes for the reactor):
- `VerifierTest`: 9 tests without running Maven: argument splitting, local
repository lookup, artifact and metadata paths, a suite type through the
override, artifact checks and deletion, log checks with ANSI and Velocity
lines, file and jar-entry checks, filtering, `${artifact:}` markers.
- `ResourceExtractorTest`: a directory with several files extracted from a
jar (fails on the seed), and a class-path directory used in place or copied.
- `VerifierExecuteTest`: forked and embedded Maven 3, forked Maven 4:
`install` then artifact checks; `addCliOption("-pl b -am validate")` builds a
and b but not c; a failing build throws and leaves its log. Embedded Maven 4 is
left out because of E1 in #49 (it hangs on a failed build).
Not in this PR: T2 (the JUnit 5 extension) and A3 (`Builder.logFile`). The
module version follows the reactor, and #49 places T1 in 2.x.
Part of #49
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]