Skip to content

Commit 5c88544

Browse files
docs(java-dedup): clarify pom.xml changes are optional (#856)
* docs(java-dedup): clarify pom.xml changes are optional - Empirically verified that the Java dedup agent is a pure -javaagent (Premain-Class only, Can-Redefine-Classes=false, Can-Retransform-Classes=false), so it does not modify application bytecode at compile time or retransform at load time. No source-code or pom.xml changes are required to enable dedup. - Restructured the "Pre-requisite" section to lead with the runtime-only requirement (both agent JARs available on disk for -javaagent:) and present three equivalent ways to obtain the JARs: A. mvn dependency:copy (no pom edit) B. direct curl from Maven Central (no Maven required) C. existing maven-dependency-plugin block in pom.xml (now framed as optional convenience) - Verified end-to-end with samples-java/java-dedup: built with unmodified pom.xml, fetched keploy-sdk.jar via mvn dependency:copy, ran keploy test --dedup against 400 testcases (400/400 passed), keploy dedup produced duplicates.yaml with 18 unique / 381 duplicate. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com> * docs(java-dedup): fix Vale lint errors and Option B mkdir step - Reword "retransform classes at load time" to "while classes load" to avoid the Vale.Spelling false positive on "retransform" while keeping the meaning intact. - Replace four em-dashes that had surrounding spaces (Google.EmDash) in the Option A/B/C labels and the Option C explanation. Use a comma for the labels and a semicolon mid-sentence in Option C. - Address Copilot review: prepend `mkdir -p target` to Option B so the curl commands work on a fresh checkout (target/ would not exist yet before the application is built). - Verified locally: vale on the changed file reports 0 errors, 0 warnings, 0 suggestions. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com> * docs(java-dedup): streamline deduplication instructions and remove redundant notes - Simplified language around the Java agent's bytecode modification, clarifying that no source code or `pom.xml` changes are necessary for deduplication. - Removed unnecessary emphasis on the `-javaagent:` requirement and streamlined the instructions for fetching the required JARs. - Updated the formatting of the Option A section for clarity. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com> * docs(java-dedup): minor formatting adjustments in deduplication instructions - Fixed spacing inconsistencies in the Java deduplication documentation, particularly around the `-javaagent:` requirement and the Option A section. - Ensured clarity and consistency in the presentation of instructions without altering the content. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com> --------- Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
1 parent 8d2ffb4 commit 5c88544

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

versioned_docs/version-4.0.0/keploy-cloud/deduplication.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,35 @@ keploy dedup --rm
123123

124124
Java dynamic deduplication uses JaCoCo runtime coverage. Attach the Keploy Java agent to emit per-test coverage signals, and attach the JaCoCo runtime agent so the SDK can read the coverage data. The Java agent is framework-agnostic across Spring Boot, Dropwizard/Jersey, plain executable jars, classpath-based apps, servlet/WAR archives, etc.
125125

126-
Copy both jars into `target/` during your Maven build (do not add the Keploy SDK as an application dependency, and do not import Keploy classes from your code).
126+
Both agents attach at JVM startup via `-javaagent:`. They do not modify your application bytecode either at compile time or while classes load, so no source code or `pom.xml` changes are required to enable dedup.
127+
128+
You only need `keploy-sdk.jar` and `jacocoagent.jar` available on disk wherever you reference them with `-javaagent:` at runtime. Fetch them in whichever way fits your workflow:
129+
130+
**Option A**, one-off fetch with the Maven CLI:
131+
132+
```bash
133+
mvn dependency:copy \
134+
-Dartifact=io.keploy:keploy-sdk:2.0.6 \
135+
-DoutputDirectory=target -Dmdep.stripVersion=true
136+
137+
mvn dependency:copy \
138+
-Dartifact=org.jacoco:org.jacoco.agent:0.8.12:jar:runtime \
139+
-DoutputDirectory=target -Dmdep.stripVersion=true
140+
```
141+
142+
**Option B**, direct download from Maven Central (no Maven required):
143+
144+
```bash
145+
mkdir -p target
146+
147+
curl -L -o target/keploy-sdk.jar \
148+
https://repo.maven.apache.org/maven2/io/keploy/keploy-sdk/2.0.6/keploy-sdk-2.0.6.jar
149+
150+
curl -L -o target/jacocoagent.jar \
151+
https://repo.maven.apache.org/maven2/org/jacoco/org.jacoco.agent/0.8.12/org.jacoco.agent-0.8.12-runtime.jar
152+
```
153+
154+
**Option C**, let your Maven build copy them automatically. If you'd rather Maven fetch the agents during your normal build, add the following plugin block to your `pom.xml`. It runs at the `package` phase and only copies the two JARs alongside your app jar; it does not alter the compile classpath, your application bytecode, or any source file:
127155

128156
```xml
129157
<plugin>

0 commit comments

Comments
 (0)