用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/apache/skywalking-java --skill compile命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | compile |
| description | Build the SkyWalking Java agent — full build, skip tests, single module, or plugin test scenarios |
| user-invocable | true |
| allowed-tools | Bash, Read, Glob, Grep |
Build the project based on user request. Detect what they want to build and run the appropriate command.
./mvnw (Maven wrapper)Check JDK version first:
java -version
If submodules are not initialized:
git submodule init && git submodule update
./mvnw clean package -Pall
./mvnw clean package -Dmaven.test.skip=true
./mvnw clean verify install javadoc:javadoc -Dmaven.test.skip=true
./mvnw clean package -pl apm-sniffer/apm-sdk-plugin/{plugin-name} -am -Dmaven.test.skip=true
The -am flag builds required dependencies. Replace {plugin-name} with the actual plugin directory name.
./mvnw checkstyle:check
./mvnw test -pl apm-sniffer/apm-sdk-plugin/{plugin-name}
The built agent is in skywalking-agent/ directory after a full build.
The E2E test framework has a two-phase build (matching CI):
Phase 1 — Build agent + test tools + Docker images (one-time setup):
# Build the agent (JDK 17+ required)
./mvnw clean package -Dmaven.test.skip=true
# Switch to JDK 8 to build test tools and Docker images
# The test/plugin/pom.xml builds: runner-helper, agent-test-tools, JVM/Tomcat container images
export JAVA_HOME=$(/usr/libexec/java_home -v 8)
export PATH=$JAVA_HOME/bin:$PATH
./mvnw --batch-mode -f test/plugin/pom.xml \
-Dmaven.test.skip \
-Dbase_image_java=eclipse-temurin:8-jdk \
-Dbase_image_tomcat=tomcat:8.5-jdk8-openjdk \
-Dcontainer_image_version=1.0.0 \
clean package
This builds skywalking/agent-test-jvm:1.0.0 and skywalking/agent-test-tomcat:1.0.0 Docker images,
plus test/plugin/dist/plugin-runner-helper.jar and test/plugin/agent-test-tools/dist/ (mock-collector, validator).
Phase 2 — Run test scenarios (per scenario):
# Use JDK 8 (matching CI). JDK 17 works for runner-helper but JDK 8 matches CI exactly.
export JAVA_HOME=$(/usr/libexec/java_home -v 8)
export PATH=$JAVA_HOME/bin:$PATH
# Run WITHOUT -f (reuses pre-built tools and images from Phase 1)
bash ./test/plugin/run.sh --debug {scenario-name}
IMPORTANT flags:
--debug — keeps workspace with logs and actualData.yaml for inspection after test-f (force) — rebuilds ALL test tools and Docker images from scratch. Do NOT use if Phase 1 already completed — it re-clones skywalking-agent-test-tool from GitHub and rebuilds everything, which is slow and may fail due to network issues.-f — reuses existing tools/images. This is the normal way to run tests.Key rules:
eclipse-temurin:8-jdk base imageplugins-jdk17-test workflows) use eclipse-temurin:17-jdk base imagetest/plugin/workspace/{scenario}/{version}/data/actualData.yaml vs expectedData.yaml for debugging failurestest/plugin/workspace/{scenario}/{version}/logs/ for container logsDiagnosing "startup script not exists" failures:
This error means the scenario ZIP wasn't built or copied into the container. The root cause is almost always a silent Maven build failure — run.sh uses mvnw -q (quiet mode) which hides errors. Common causes:
mvnw clean package exits non-zero but the -q flag hides the error, and run.sh continues with missing artifacts.test/plugin/workspace/ can interfere. Always rm -rf test/plugin/workspace/{scenario} before rerunning.To debug: run the Maven build manually in the scenario directory with verbose output:
cd test/plugin/scenarios/{scenario-name}
../../../../mvnw clean package -Dtest.framework.version={version} -Dmaven.test.skip=true
If this succeeds but run.sh fails, it's likely a transient Maven Central network issue. Pre-download dependencies first:
# Pre-warm Maven cache for all versions before running tests
for v in $(grep -v '^#' test/plugin/scenarios/{scenario}/support-version.list | grep -v '^$'); do
cd test/plugin/scenarios/{scenario}
../../../../mvnw dependency:resolve -Dtest.framework.version=$v -q
cd -
done
Pre-pulling Docker dependency images:
Scenarios with dependencies: in configuration.yml need external Docker images. Pre-pull them before running tests to avoid mid-test Docker Hub failures:
# Check what images a scenario needs
grep "image:" test/plugin/scenarios/{scenario}/configuration.yml
# Pull them
docker pull {image:tag}
./mvnw compile -Dmaven.test.skip=true
Then mark */target/generated-sources/protobuf/java and */target/generated-sources/protobuf/grpc-java as generated source folders in your IDE.
git submodule init && git submodule updatejava -version../mvnw checkstyle:check to see violations. Common: star imports, unused imports, System.out.println, missing @Override.--debug flag to inspect actualData.yaml.run.sh -f fails on agent-test-tools: The -f flag clones skywalking-agent-test-tool from GitHub and rebuilds from source. If GitHub is slow or unreachable, this fails. Solution: run Phase 1 build separately (see above), then use run.sh without -f.mvnw clean package succeeds in the scenario directory and produces both a .jar and .zip in target/.