From 14069015297f88defa4d091ddae70e242ba67777 Mon Sep 17 00:00:00 2001 From: Tim Rutana - reebow Date: Thu, 12 Jun 2025 11:05:56 +0900 Subject: [PATCH] docs: add Gradle instructions for launching the ADK web server --- docs/get-started/testing.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/get-started/testing.md b/docs/get-started/testing.md index bb132f2fc..ebe7afe39 100644 --- a/docs/get-started/testing.md +++ b/docs/get-started/testing.md @@ -13,11 +13,38 @@ to use the ADK web UI with the following commands. === "Java" Make sure to update the port number. - - ```java - mvn compile exec:java \ + === "Maven" + With Maven, compile and run the ADK web server: + ```console + mvn compile exec:java \ -Dexec.args="--adk.agents.source-dir=src/main/java/agents --server.port=8080" - ``` + ``` + === "Gradle" + With Gradle, the `build.gradle` or `build.gradle.kts` build file should have the following Java plugin in its plugins section: + + ```groovy + plugins { + id('java') + // other plugins + } + ``` + Then, elsewhere in the build file, at the top-level, create a new task: + + ```groovy + tasks.register('runADKWebServer', JavaExec) { + dependsOn classes + classpath = sourceSets.main.runtimeClasspath + mainClass = 'com.google.adk.web.AdkWebServer' + args '--adk.agents.source-dir=src/main/java/agents', '--server.port=8080' + } + ``` + + Finally, on the command-line, run the following command: + ```console + gradle runADKWebServer + ``` + + In Java, both the Dev UI and the API server are bundled together. This command will launch a local web