You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds Java-agent support for Java dynamic dedup and prepares io.keploy:keploy-sdk:2.0.0 as the runtime agent artifact.\n\nSigned-off-by: Asish Kumar <officialasishkumar@gmail.com>
Copy file name to clipboardExpand all lines: README.md
+41-50Lines changed: 41 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,78 +23,69 @@ Coverage is collected at per-testcase granularity, not process granularity.
23
23
24
24
## How to Use
25
25
26
-
### 1. Add the SDK
26
+
### 1. Download the Keploy Java Agent
27
27
28
-
Add `keploy-sdk`to your application:
28
+
Download the `keploy-sdk`jar and keep it outside your application dependencies. The jar is a Java agent and should be attached only when you run Keploy dynamic deduplication.
The middleware starts the Java dedup control server automatically.
65
-
66
-
For Jakarta Servlet stacks, non-servlet frameworks, or any application where the `javax.servlet` filter is not available, start the agent directly during application startup:
67
-
68
-
```java
69
-
importio.keploy.dedup.KeployDedupAgent;
70
-
71
-
KeployDedupAgent.start();
72
-
```
73
-
74
-
### 3. Run the App with the JaCoCo Java Agent
60
+
### 2. Run the App with the Keploy and JaCoCo Java Agents
75
61
76
62
The dedup agent reads coverage in-process via JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent()`), so attaching the JaCoCo Java agent is the only runtime requirement in the common cases below:
77
63
78
64
- Maven/Gradle dev runs where application classes are under `target/classes` or `build/classes/java/main`
79
65
- packaged `java -jar` runs where the application classes live inside the executable jar
If the in-process API is unavailable (for example because the JaCoCo agent is loaded into an isolated classloader), the SDK transparently falls back to JaCoCo's TCP server mode. To use the fallback explicitly, start JaCoCo in `tcpserver` mode and set `KEPLOY_JACOCO_HOST` / `KEPLOY_JACOCO_PORT`:
keploy test -c "java -javaagent:/path/to/jacocoagent.jar -jar your-app.jar" \
88
+
keploy test -c "java -javaagent:/path/to/keploy-sdk.jar -javaagent:/path/to/jacocoagent.jar -jar your-app.jar" \
98
89
--dedup \
99
90
--language java
100
91
```
@@ -128,8 +119,8 @@ Without a shared `/tmp`, dedup will not work inside containers because Enterpris
128
119
129
120
-`KEPLOY_JACOCO_HOST`: JaCoCo TCP host used when the in-process runtime API is unavailable. Default: `127.0.0.1`
130
121
-`KEPLOY_JACOCO_PORT`: JaCoCo TCP port used when the in-process runtime API is unavailable. Default: `36320`
131
-
-`KEPLOY_JAVA_CLASS_DIRS`: optional comma-separated classor jar locations to analyze for executed lines when your build output lives outside the standard locations
132
-
-`KEPLOY_JAVA_CLASSPATH_FALLBACK`: scans the full classpath if standard class roots and the executable jar do not provide application classes. Default: `false`
122
+
-`KEPLOY_JAVA_CLASS_DIRS`: optional comma-separated class, jar, war, ear, or zip locations to analyze for executed lines when your build output lives outside the standard locations
123
+
-`KEPLOY_JAVA_CLASSPATH_FALLBACK`: scans the full classpath if standard class roots and the executable archive do not provide application classes. Default: `true`
133
124
-`KEPLOY_JAVA_DEDUP_DISABLED`: disables the Java dedup agent when set to `true`, `1`, or `yes`
134
125
135
126
## Sample
@@ -138,4 +129,4 @@ For a working reference, see the Java dedup sample in `keploy/samples-java`:
138
129
139
130
-`samples-java/java-dedup`
140
131
141
-
That sample is used in CI to validate Java dynamic dedup for JDK 8, 17, and 21 across native, Docker, and restricted Docker runs.
132
+
That sample is used in CI to validate Java dynamic dedup for JDK 8, 17, and 21 across native, classpath, Docker, distroless, and restricted Docker runs.
0 commit comments