maven-build-lifecycle
Use when reproducing and repairing Maven CI build failures (legacy multi-module + Maven Invoker), while producing the required benchmark artifacts: `/home/travis/build/failed/failed_reasons.txt` and `/home/travis/build/failed/<repo>/<id>/patch_*.diff`.
- 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 (legacy multi-module + Maven Invoker), while producing the required benchmark artifacts: `/home/travis/build/failed/failed_reasons.txt` and `/home/travis/build/failed/<repo>/<id>/patch_*.diff`.
03 SKILL.md 正文
Maven Build Lifecycle — Legacy CI Repair Workflow
Toolchain + failure reproduction (do this before editing)
- Resolve the concrete checkout directory under
/home/travis/build/failedandcdinto the checkout root (the leaf directory under/home/travis/build/failed/...where you will writepatch_*.diff):ls -la /home/travis/build/failedls -la /home/travis/build/failed/<repo-or-org>(e.g.google)ls -la /home/travis/build/failed/<repo-or-org>/<repo-or-id>(e.g.auto)- If there is one more leaf directory level (often the
<id>),ls -la /home/travis/build/failed/<repo-or-org>/<repo-or-id>/<id>thencdinto it; otherwisecd /home/travis/build/failed/<repo-or-org>/<repo-or-id>. - From the directory you
cdinto, confirm where the reactor/rootpom.xmllives:- If
pom.xmlis in the checkout root, use it. - If not, locate it without guessing:
find . -maxdepth 4 -name pom.xml -printand choose the root/aggregatorpom.xml(usually the one closest to the checkout root). Eithercdinto that directory, or plan to run Maven with-f path/to/root/pom.xml.
- If
- Record the absolute checkout path (
pwd) becausepatch_*.diffmust be written inside this directory (per benchmark path contract).
- Pick the Maven entrypoint consistently (use the same one for
-v, builds, and re-runs):- If
./mvnwexists (in the checkout root), runchmod +x ./mvnwand use./mvnw. - Otherwise use system Maven:
mvn.
- If
- Create/update
/home/travis/build/failed/failed_reasons.txtbefore attempting fixes (so the artifact exists from the start) and record the toolchain + context:- repo path (
pwd) - Maven info (
./mvnw -vormvn -v) - Java info (
java -version)
- repo path (
- Reproduce the failure using the project’s CI build command when possible:
- First look for the Maven goals/profiles in
.travis.yml,.github/workflows/*.yml,Jenkinsfile, or README; use that command as your reproduction command. - If no CI command is discoverable, default to a CI-like lifecycle goal:
./mvnw -e verify(ormvn -e verify; add-f <path/to/root/pom.xml>if the root POM is not in the checkout root). - After the run, immediately add to
/home/travis/build/failed/failed_reasons.txt:- the exact command used,
- the first concrete failure (copy the relevant log excerpt),
- whether it’s code vs build config,
- your minimal fix plan.
- Prefer passing flags on the command line while diagnosing. If Maven fails to transfer from remote repos (e.g., HTTP 403/401/timeouts) and a seeded cache exists at
/home/travis/.m2/repository, try-Dmaven.repo.local=/home/travis/.m2/repositoryto confirm it’s an environment/repo-local issue; only use-oafter verifying required artifacts are already present.
- First look for the Maven goals/profiles in
Only after you have the first concrete failure should you change code/config (and as you edit, keep the change as a git diff you’ll save to patch_1.diff). Avoid broad edits (e.g., removing parents, upgrading unrelated dependencies) until you can tie them directly to that first failure.
If Maven fails before compilation/tests: fix dependency resolution first
If the log fails during dependency resolution (no compilation has started yet), stop and repair the specific POM/dependency/plugin configuration causing that resolution error.
For transfer failures (HTTP 403/401/timeouts), first check whether the “missing” coordinates already exist under /home/travis/.m2/repository and whether Maven is using a different local repo; if pointing Maven at the seeded cache via -Dmaven.repo.local=/home/travis/.m2/repository fixes it, make that change reproducible (e.g., add it to .mvn/maven.config) and include it in your patch.
Re-run the same Maven command you used to reproduce afterward to ensure you moved past the original failure.
Java 9+ compatibility: tools.jar / com.sun:tools system dependency
If you see an error like:
Could not find artifact com.sun:tools:jar:… at specified path …/lib/tools.jar
that’s almost always a Java 9+ incompatibility: tools.jar existed in JDK 8 but was removed starting Java 9, so any <scope>system</scope> dependency pointing at ${java.home}/../lib/tools.jar will break on Java 11+.
Repair workflow:
- Locate the declaration(s) by copying the coordinates/path from the Maven error and searching (avoid hand-typed guesses):
rg -n "com\.sun:tools|tools\.jar" pom.xml **/pom.xml(orgrep -RInifrgis unavailable)
- Update the POM so Java 9+ builds do not try to resolve
tools.jar:- Prefer removing the system-scoped
com.sun:toolsdependency when the build runs on a full JDK. - If Java 8 support is still needed, gate the
tools.jardependency behind a JDK-8-only Maven profile (e.g., activate only for[1.8,1.9)), so Java 11 doesn’t attempt to resolve it.
- Prefer removing the system-scoped
- Re-run the same Maven command you used to reproduce to confirm dependency resolution proceeds past the original error.
Maven Invoker failures: debug the nested project, not just the reactor
maven-invoker-plugin can launch independent Maven builds from files such as
src/it/*/pom.xml. Those nested builds have their own dependency mediation and
can fail even when the parent module's normal unit tests pass.
If Maven reports output similar to:
The following builds failed:
* functional/pom.xml
then:
- Locate the exact integration-test POM named by the Invoker.
- Read the corresponding Invoker
build.logor the surrounding CI output. - Identify the first concrete compiler/test error inside that nested build.
- Inspect the nested POM's direct dependencies and versions.
- Repair the nested dependency/configuration drift instead of broad-editing unrelated top-level modules.
Do not assume versions declared in the parent module automatically govern an Invoker integration-test POM. An integration-test POM copied or synchronized separately can become stale.
Missing library classes usually indicate dependency-version drift
For a compiler error such as:
cannot find symbol: class MoreObjects
location: package com.google.common.base
first ask which Guava version the failing nested build actually selected.
MoreObjects is an API-version signal: a stale/transitively selected Guava can
make valid test source fail even though the main reactor uses a newer Guava.
For test libraries that are designed to be version-coupled (for example
guava and guava-testlib), prefer an explicit, synchronized dependency set.
Do not "fix" valid source by rewriting it to avoid the missing API unless the
source itself is demonstrated to be wrong.
Repository-specific checkpoint: Google Auto / AutoValue
In this Google Auto snapshot, common CI breakages tend to be:
- Early failure on Java 11+:
com.sun:tools/tools.jarsystem dependency in a root/module POM (fix using the Java 9+ workflow above). - Later Invoker failure (only after the main build runs far enough to execute Invoker): AutoValue functional integration test rooted at:
If the Invoker log shows missing Guava/Truth APIs, synchronize that functional-test POM as one coherent dependency repair rather than piecemeal edits:value/src/it/functional/pom.xmlcom.google.code.findbugs:jsr305->3.0.0(provided);junit:junit->4.12(test);- add a direct
com.google.guava:guava:19.0test dependency; com.google.guava:guava-testlib->19.0(test);com.google.truth:truth->0.28(test).
Build-repair artifact contract
This benchmark requires both a diagnosis artifact and an applicable patch. Before finishing:
- Ensure
/home/travis/build/failed/failed_reasons.txtexists and includes: toolchain (mvn -v/java -version), the exact command used to reproduce, the first real error, and the minimal root cause + plan. - Create at least one non-empty standard unified diff at
/home/travis/build/failed/<repo>/<id>/patch_1.diff(or higher{i}) containing the intended source/configuration change:- Make the edit(s), then (from the checkout root) generate the patch artifact in its own shell invocation:
git diff > patch_1.diff - Confirm the benchmark artifact is present and non-empty:
test -s patch_1.diff
- Make the edit(s), then (from the checkout root) generate the patch artifact in its own shell invocation:
- Apply that patch to the failed repository (e.g., from the checkout root:
git apply patch_1.diff). If you generated the patch from local edits, you can make the diff the source-of-truth by doing:git reset --hard(keepspatch_1.diff) →git apply patch_1.diff. - Check
git diff/git status, then rerun the same Maven command and ensure the original failure is gone (ideallyBUILD SUCCESS).
Minimal diagnostic sequence
# Locate the checkout (example org/repo layout).
ls -la /home/travis/build/failed
ls -la /home/travis/build/failed/<org>
ls -la /home/travis/build/failed/<org>/<repo>
cd /home/travis/build/failed/<org>/<repo>/<id>
# Reproduce with a CI-like lifecycle goal (use ./mvnw if present).
mvn -e verify
# If you see a tools.jar/com.sun:tools resolution error, locate it in POMs.
rg -n "com\.sun:tools|tools\.jar" pom.xml **/pom.xml
# If Invoker reports a failing src/it POM, inspect that nested POM + build logs.
sed -n '1,220p' value/src/it/functional/pom.xml
find . -path '*target/it*' -name build.log -print
General Maven lifecycle reminders
- In multi-module projects, use the reactor summary to identify the first genuinely failing module, then inspect that module's own integration steps.
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