Whole file
awslabs/aws-lambda-builders
The author described this change as “Fix #502: Capture Maven stderr in error messages (#822)”. It counts as a record because the checks below fail on the code as it stood at 051c6ef2f and pass on 8ccbae9b5, with nothing else changed between the two runs.
Projectawslabs/aws-lambda-builders
Fix saved2026-01-20
Sharing licenceApache-2.0 · LICENSE
Change size+4 −4
What the code was meant to do, written into the code itself as a save note
Fix #502: Capture Maven stderr in error messages (#822)
The change
| 28 | 28 | ||
| 29 | 29 | def build(self, scratch_dir): | |
| 30 | 30 | args = ["clean", "install"] | |
| 31 | - | ret_code, stdout, _ = self._run(args, scratch_dir) | |
| 31 | + | ret_code, stdout, stderr = self._run(args, scratch_dir) | |
| 32 | 32 | ||
| 33 | 33 | LOG.debug("Maven logs: %s", decode(stdout)) | |
| 34 | 34 | ||
| 35 | 35 | if ret_code != 0: | |
| 36 | - | raise MavenExecutionError(message=decode(stdout)) | |
| 36 | + | raise MavenExecutionError(message=decode(stderr)) | |
| 37 | 37 | ||
| 38 | 38 | def copy_dependency(self, scratch_dir): | |
| 39 | 39 | include_scope = "runtime" | |
| 40 | 40 | LOG.debug("Running copy_dependency with scope: %s", include_scope) | |
| 41 | 41 | args = ["dependency:copy-dependencies", f"-DincludeScope={include_scope}", "-Dmdep.prependGroupId=true"] | |
| 42 | - | ret_code, stdout, _ = self._run(args, scratch_dir) | |
| 42 | + | ret_code, stdout, stderr = self._run(args, scratch_dir) | |
| 43 | 43 | ||
| 44 | 44 | if ret_code != 0: | |
| 45 | - | raise MavenExecutionError(message=decode(stdout)) | |
| 45 | + | raise MavenExecutionError(message=decode(stderr)) | |
| 46 | 46 | ||
| 47 | 47 | def _run(self, args, cwd=None): | |
| 48 | 48 | p = self.os_utils.popen( |
The check that tells the two apart
fail→pass·tests/unit/workflows/java_maven/test_maven.py::TestSubprocessMaven::test_build_raises_exception_if_retcode_not_0
fail→pass·tests/unit/workflows/java_maven/test_maven.py::TestSubprocessMaven::test_copy_dependency_raises_exception_if_retcode_not_0
Check file tests/unit/workflows/java_maven/test_maven.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it051c6ef2fd0079190c758f1622af7a68e48eb723
Broken version dated2026-01-16
Moduleaws_lambda_builders.workflows.java_maven.maven
Units changedSubprocessMaven
Fingerprint4c83d6e1295ce5c5
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.