maven-build-lifecycle
Use when reproducing and repairing Maven CI build failures, especially legacy multi-module builds and Maven Invoker integration tests.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- maven-build-lifecycle
- description
- Use when reproducing and repairing Maven CI build failures, especially legacy multi-module builds and Maven Invoker integration tests.
03 SKILL.md 正文
Maven Build Lifecycle — Legacy CI Repair Workflow
Core rule: reproduce the target CI before changing the project
For build-repair tasks, the first successful local command is not enough. The
failure must be reproduced under the toolchain and Maven command used by the
target CI. Read the repository's CI configuration (.travis.yml, workflow
files, wrapper scripts, build POMs) before interpreting any compiler or
dependency error.
Record at least:
java -version
javac -version
mvn -version
If the repository declares a historical JDK and the container's default Java is newer, switch to the declared JDK before patching project files. A failure caused only by running an old project on a modern JDK is not evidence that the project should be migrated.
For environments that provide the BugSwarm JDK switcher, a Travis build that pins an older JDK can be reproduced with (example for JDK 7):
source /opt/jdk_switcher/jdk_switcher.sh
jdk_switcher use openjdk7
export TRAVIS_JDK_VERSION=openjdk7
java -version
Then run the exact CI build command, including any non-default reactor POM:
mvn -Dhttps.protocols=TLSv1.2 -B -U -f build-pom.xml verify \
--fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true
Maven Invoker / nested test projects: fix the template POMs, not generated copies
If the build fails while running Maven Invoker (or any integration test that builds “nested projects”), treat those nested projects as real builds with their own dependency resolution:
- Identify where the nested projects are sourced from (commonly
src/it/**,src/test/resources/**, or a dedicatedit/directory). - Apply dependency/plugin/version fixes to the source templates under the
repository, not to generated directories under
target/**(those will be recreated on every run). - If the top-level build succeeds but invoker projects fail to resolve deps,
inspect the nested project
pom.xmland its parent/repository settings; it may not inherit the same dependencyManagement/pluginManagement as the reactor.
Do not modernize away historical-JDK symptoms
When CI declares an old JDK (e.g., JDK 7), do not respond to a default-JDK-11 failure by blindly doing any of the following:
- changing Java source/target solely to make the project compile on Java 11;
- removing or excluding
com.sun:tools/tools.jarsolely because Java 9+ no longer ships it; - adding replacement annotation APIs solely for
javax.annotation.Generated; - changing production logic because javac's post-Java-8 module model produces different compiler-element behavior.
First reproduce on the declared JDK. Only errors that remain under the target
CI environment should drive the repair. (Conversely, if CI is already on Java 9+,
then tools.jar/system-scope issues are genuine build breakages to fix.)
Build-repair artifact contract (must satisfy for evaluation)
This benchmark requires both a diagnosis artifact and an applicable patch. Create these artifacts early (right after you have a reproducible failure), not at the end.
- Write a non-empty diagnosis + plan to:
/home/travis/build/failed/failed_reasons.txt - Create at least one non-empty unified diff at:
/home/travis/build/failed/<repo>/<id>/patch_1.diff(incrementpatch_{i}.diffif you need multiple patches)- Prefer generating patches via
git diff > patch_1.diffso you don’t have to hand-author multi-line diff content.
- Prefer generating patches via
- Ensure the repository working tree actually reflects the patch (not only the
patch artifact):
- verify with
git statusandgit diff --stat
- verify with
- Re-run the exact CI verification command (same JDK, same Maven flags, same reactor POM) until it succeeds, including any Maven Invoker integration tests.
Minimal diagnostic sequence (run each command separately)
The execution tool in this environment may reject multi-line / multi-command blocks; run commands one-at-a-time.
- Enter the repository (use the task-provided
<repo>/<id>path):cd /home/travis/build/failed/<repo>/<id> - Inspect CI config to find the real build command and JDK:
ls -lased -n '1,220p' .travis.yml - Record tool versions (paste these into
failed_reasons.txt):java -versionjavac -versionmvn -version - Reproduce the failure with the CI command. If the environment is offline or
dependencies are expected to come from the local cache, also try an offline
run to get actionable “missing artifact/plugin” coordinates:
mvn -o -B -e verify --fail-at-end - Locate the source of the error:
- For missing artifact/plugin coordinates: check whether it’s a build plugin resolution issue vs a normal dependency issue (plugins resolve too).
- For “file not found” /
systemPathbreakage: grep the repository for the failing coordinate/path string (e.g.,tools.jar). - If you suspect offline-cache gaps, confirm what is and isn’t present under
~/.m2/repository/to narrow the failure.
- Immediately write/update the required diagnosis+plan file:
- Use a one-liner write so you don’t need multi-line shell blocks:
printf '%s\n' \ "Repro command: <paste exact mvn command>" \ "Observed failure: <paste key Maven error lines>" \ "Root cause guess: <code vs build config?>" \ "Plan: <files to change + why>" \ > /home/travis/build/failed/failed_reasons.txt
- Use a one-liner write so you don’t need multi-line shell blocks:
General Maven lifecycle reminders
mvn testdoes not imply thatmvn verifypasses.verifycan execute integration-test and Invoker steps thattestnever reaches.- A green command run under the wrong JDK is not sufficient evidence of a valid CI repair.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms