Skip to content

Commit 6042cca

Browse files
authored
Split the examples into two directories, one for client and one for server, and update dependencies accordingly (#124)
This PR splits the examples into two different modules, one for client and one for server and updates the instructions accordingly. It also cleans up some dependencies and removes unnecessary ones.
1 parent ea9ed89 commit 6042cca

File tree

14 files changed

+145
-50
lines changed

14 files changed

+145
-50
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ A complete example of an A2A client communicating with a Python A2A server is av
344344
- Sending regular and streaming messages
345345
- Receiving and processing responses
346346

347-
The example includes detailed instructions on how to run both the Python server and the Java client using JBang. Check out the [example's README](src/main/java/io/a2a/examples/helloworld/README.md) for more information.
347+
The example includes detailed instructions on how to run both the Python server and the Java client using JBang. Check out the [example's README](examples/client/src/main/java/io/a2a/examples/helloworld/README.md) for more information.
348348

349349
## License
350350

core/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
<groupId>io.smallrye.reactive</groupId>
3030
<artifactId>mutiny-zero</artifactId>
3131
</dependency>
32-
<dependency>
33-
<groupId>io.quarkus</groupId>
34-
<artifactId>quarkus-arc</artifactId>
35-
</dependency>
3632
<dependency>
3733
<groupId>jakarta.enterprise</groupId>
3834
<artifactId>jakarta.enterprise.cdi-api</artifactId>
@@ -42,6 +38,11 @@
4238
<groupId>org.slf4j</groupId>
4339
<artifactId>slf4j-api</artifactId>
4440
</dependency>
41+
<dependency>
42+
<groupId>io.quarkus</groupId>
43+
<artifactId>quarkus-arc</artifactId>
44+
<scope>test</scope>
45+
</dependency>
4546
<dependency>
4647
<groupId>org.junit.jupiter</groupId>
4748
<artifactId>junit-jupiter-api</artifactId>

examples/client/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.a2a.sdk</groupId>
9+
<artifactId>a2a-java-sdk-examples-parent</artifactId>
10+
<version>0.2.4-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>a2a-java-sdk-examples-client</artifactId>
14+
15+
<name>Java SDK A2A Examples</name>
16+
<description>Examples for the Java SDK for the Agent2Agent Protocol (A2A)</description>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>io.a2a.sdk</groupId>
21+
<artifactId>a2a-java-sdk-core</artifactId>
22+
</dependency>
23+
</dependencies>
24+
25+
<build>
26+
<plugins>
27+
<plugin>
28+
<groupId>org.apache.maven.plugins</groupId>
29+
<artifactId>maven-compiler-plugin</artifactId>
30+
<version>${maven-compiler-plugin.version}</version>
31+
<configuration>
32+
</configuration>
33+
</plugin>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-surefire-plugin</artifactId>
37+
<version>${maven-surefire-plugin.version}</version>
38+
</plugin>
39+
</plugins>
40+
</build>
41+
</project>

examples/src/main/java/io/a2a/examples/helloworld/client/HelloWorldClient.java renamed to examples/client/src/main/java/io/a2a/examples/helloworld/HelloWorldClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.a2a.examples.helloworld.client;
1+
package io.a2a.examples.helloworld;
22

33
import java.util.HashMap;
44
import java.util.Map;

examples/src/main/java/io/a2a/examples/helloworld/client/HelloWorldRunner.java renamed to examples/client/src/main/java/io/a2a/examples/helloworld/HelloWorldRunner.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
2-
//REPOS file://~/.m2/repository/
3-
//DEPS io.a2a.sdk:a2a-java-sdk:0.2.4-SNAPSHOT
2+
//DEPS io.a2a.sdk:a2a-java-sdk-core:0.2.4-SNAPSHOT
43
//SOURCES HelloWorldClient.java
54

65
/**
@@ -18,6 +17,6 @@
1817
*/
1918
public class HelloWorldRunner {
2019
public static void main(String[] args) {
21-
io.a2a.examples.helloworld.client.HelloWorldClient.main(args);
20+
io.a2a.examples.helloworld.HelloWorldClient.main(args);
2221
}
2322
}

examples/src/main/java/io/a2a/examples/helloworld/client/INSTALL_JBANG.md renamed to examples/client/src/main/java/io/a2a/examples/helloworld/INSTALL_JBANG.md

File renamed without changes.

examples/src/main/java/io/a2a/examples/helloworld/client/README.md renamed to examples/client/src/main/java/io/a2a/examples/helloworld/README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ cd /path/to/a2a-java
5454
mvn clean install
5555
```
5656

57-
### Option 1: Using the JBang script (Recommended)
57+
### Using the JBang script
5858

5959
A JBang script is provided in the example directory to make running the client easy:
6060

6161
1. Make sure you have JBang installed. If not, follow the [JBang installation guide](https://www.jbang.dev/documentation/guide/latest/installation.html).
6262

6363
2. Navigate to the example directory:
6464
```bash
65-
cd examples/src/main/java/io/a2a/examples/helloworld/client
65+
cd examples/client/src/main/java/io/a2a/examples/helloworld
6666
```
6767

6868
3. Run the client using the JBang script:
@@ -72,20 +72,6 @@ A JBang script is provided in the example directory to make running the client e
7272

7373
This script automatically handles the dependencies and sources for you.
7474

75-
### Option 2: Running with explicit classpath
76-
77-
Alternatively, you can run the Java client with JBang by specifying the classpath explicitly:
78-
79-
1. First, build the project with Maven:
80-
```bash
81-
mvn clean package
82-
```
83-
84-
2. Run the Java client with JBang from the root of the a2a-java project:
85-
```bash
86-
jbang --cp target/classes examples/src/main/java/io/a2a/examples/helloworld/client/HelloWorldClient.java
87-
```
88-
8975
## What the Example Does
9076

9177
The Java client (`HelloWorldClient.java`) performs the following actions:

examples/pom.xml

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,33 @@
1010
<version>0.2.4-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>a2a-java-sdk-examples</artifactId>
13+
<artifactId>a2a-java-sdk-examples-parent</artifactId>
14+
<packaging>pom</packaging>
1415

1516
<name>Java SDK A2A Examples</name>
1617
<description>Examples for the Java SDK for the Agent2Agent Protocol (A2A)</description>
1718

18-
<dependencies>
19-
<dependency>
20-
<groupId>io.a2a.sdk</groupId>
21-
<artifactId>a2a-java-sdk-server-quarkus</artifactId>
22-
<version>${project.version}</version>
23-
</dependency>
24-
<dependency>
25-
<groupId>io.quarkus</groupId>
26-
<artifactId>quarkus-resteasy-jackson</artifactId>
27-
<scope>provided</scope>
28-
</dependency>
29-
<dependency>
30-
<groupId>jakarta.enterprise</groupId>
31-
<artifactId>jakarta.enterprise.cdi-api</artifactId>
32-
<scope>provided</scope>
33-
</dependency>
34-
<dependency>
35-
<groupId>jakarta.ws.rs</groupId>
36-
<artifactId>jakarta.ws.rs-api</artifactId>
37-
</dependency>
38-
</dependencies>
19+
<dependencyManagement>
20+
<dependencies>
21+
<dependency>
22+
<groupId>io.quarkus</groupId>
23+
<artifactId>quarkus-bom</artifactId>
24+
<version>${quarkus.platform.version}</version>
25+
<type>pom</type>
26+
<scope>import</scope>
27+
</dependency>
28+
<dependency>
29+
<groupId>io.a2a.sdk</groupId>
30+
<artifactId>a2a-java-sdk-core</artifactId>
31+
<version>${project.version}</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>io.a2a.sdk</groupId>
35+
<artifactId>a2a-java-sdk-server-quarkus</artifactId>
36+
<version>${project.version}</version>
37+
</dependency>
38+
</dependencies>
39+
</dependencyManagement>
3940

4041
<build>
4142
<plugins>
@@ -55,4 +56,9 @@
5556
</plugin>
5657
</plugins>
5758
</build>
59+
60+
<modules>
61+
<module>client</module>
62+
<module>server</module>
63+
</modules>
5864
</project>

examples/server/pom.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.a2a.sdk</groupId>
9+
<artifactId>a2a-java-sdk-examples-parent</artifactId>
10+
<version>0.2.4-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>a2a-java-sdk-examples-server</artifactId>
14+
15+
<name>Java SDK A2A Examples</name>
16+
<description>Examples for the Java SDK for the Agent2Agent Protocol (A2A)</description>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>io.a2a.sdk</groupId>
21+
<artifactId>a2a-java-sdk-server-quarkus</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>io.quarkus</groupId>
25+
<artifactId>quarkus-resteasy-jackson</artifactId>
26+
<scope>provided</scope>
27+
</dependency>
28+
<dependency>
29+
<groupId>jakarta.enterprise</groupId>
30+
<artifactId>jakarta.enterprise.cdi-api</artifactId>
31+
<scope>provided</scope>
32+
</dependency>
33+
<dependency>
34+
<groupId>jakarta.ws.rs</groupId>
35+
<artifactId>jakarta.ws.rs-api</artifactId>
36+
</dependency>
37+
</dependencies>
38+
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<groupId>io.quarkus</groupId>
43+
<artifactId>quarkus-maven-plugin</artifactId>
44+
<extensions>true</extensions>
45+
<executions>
46+
<execution>
47+
<goals>
48+
<goal>build</goal>
49+
<goal>generate-code</goal>
50+
<goal>generate-code-tests</goal>
51+
</goals>
52+
</execution>
53+
</executions>
54+
</plugin>
55+
</plugins>
56+
</build>
57+
</project>

examples/src/main/java/io/a2a/examples/helloworld/server/AgentCardProducer.java renamed to examples/server/src/main/java/io/a2a/examples/helloworld/AgentCardProducer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.a2a.examples.helloworld.server;
1+
package io.a2a.examples.helloworld;
22

33
import java.util.Collections;
44
import java.util.List;

0 commit comments

Comments
 (0)