Overview
This Maven version of the ping/pong demo generates a simple payload schema and runs server and client
processes via exec:java. It highlights the same registered buffer and transport flow as the
Gradle example.
Clone and run
-
Install Java 25 and Git, then confirm the toolchain.
java --version -
Clone the examples repository.
git clone https://github.com/mvp-express/examples.git -
Move into the Maven ping pong example folder.
cd examples/myra-codec-transport-ping-pong-maven -
Generate sources and the lock file.
./mvnw -q \ -Dexec.mainClass=express.mvp.myra.codec.codegen.MyraCodegenCli \ -Dexec.args="--schema src/main/resources/schemas/ping_pong.myra.yml --output src/main/java --lockfile src/main/resources/locks/ping_pong.myra.lock" \ exec:java -
Start the server in one terminal.
./mvnw -q -DskipTests \ -Dexec.mainClass=express.mvp.myra.examples.pingpong.PingPongServer \ -Dexec.jvmArgs="--enable-preview --enable-native-access=ALL-UNNAMED" \ compile exec:java -
Start the client in another terminal.
./mvnw -q -DskipTests \ -Dexec.mainClass=express.mvp.myra.examples.pingpong.PingPongClient \ -Dexec.jvmArgs="--enable-preview --enable-native-access=ALL-UNNAMED" \ compile exec:java
If you are on Windows, use mvnw.cmd and keep each command on a single line.
Concepts highlighted
- Codec generated
Payloadschema for ping and pong. - Maven exec workflow with explicit preview and native access flags.
- Transport client and server running in separate terminals.
- Registered buffer pools and NIO backend configuration.
- Zero copy payload decode with flyweights.
Files to explore
src/main/resources/schemas/ping_pong.myra.ymlsrc/main/java/express/mvp/myra/examples/pingpong/PingPongServer.javasrc/main/java/express/mvp/myra/examples/pingpong/PingPongClient.java