Skip to content

Getting Started

Kevin Herron edited this page Oct 12, 2026 · 11 revisions

Applies to Milo 1.2.0-RC1. Source baseline 69cb25087, 2026-10-12.

This page sets up the Maven project that the two tutorials share and shows how to compile and launch programs from it. Once the project builds, the tutorials only ask you to save a Java file and run it.

What you need

Use Java 17 or later and Maven 3.6.3 or later. Your application can embed the client SDK, the server SDK, or both. This guide's examples were built and run with Temurin 17.0.19+10 and Maven 3.9.16.

Version 1.2.0-RC1 is a release candidate, and 1.2.0 itself has not been released. The latest final release is 1.1.8, so for 1.1 APIs, use that release's source and examples. This guide's examples use 1.2 APIs, except the blocks labeled "Before" in the migration guide, which use 1.1 APIs.

Create the project

Create an empty Maven application directory and save this complete configuration as pom.xml. It includes both SDKs so the two tutorials can share one project. A client-only application can omit milo-sdk-server, and a server-only application can omit milo-sdk-client.

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>example</groupId>
  <artifactId>milo-first-programs</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <maven.compiler.release>17</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.eclipse.milo</groupId>
        <artifactId>milo-bom</artifactId>
        <version>1.2.0-RC1</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.milo</groupId>
      <artifactId>milo-sdk-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.milo</groupId>
      <artifactId>milo-sdk-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>2.0.18</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.15.0</version>
      </plugin>
    </plugins>
  </build>
</project>

The imported BOM aligns the versions of all Milo artifacts, which is why the SDK dependencies carry no version of their own. Without a BOM, give each SDK dependency the same explicit Milo version.

The SLF4J Simple dependency supplies console logging for the tutorials. In an existing application, use its logging provider instead. The compiler plugin's Java release setting controls compilation, but it does not install a JDK.

Where the artifacts come from

1.2.0-RC1 is published to Maven Central, so the POM needs no extra repository. Unlike a snapshot, a release candidate version is fixed and is not republished. It was built from the v1.2.0-RC1 tag, the source baseline above. The source README at that tag still lists older release coordinates. This tutorial's POM supersedes them.

To develop against a later source commit, follow the source build instructions and use the version that build produces, such as 1.2.0-SNAPSHOT. Maven can select a newer remote snapshot after you install a local build, or a newer local installation when you intended to use a published one. Take these steps to use your source build consistently.

  • Install it in a dedicated local repository.
  • Check that no repository, settings profile, or mirror supplies the same snapshot version.
  • Confirm resolution with the classpath file produced below, plus the maven-metadata-local.xml and repository metadata in the artifact directories.

Compile and run the tutorial programs

The tutorials give you two programs, FirstServer and FirstClient, each with the path to save it under. After you save them, compile from the application directory and write the runtime dependency classpath.

mvn -q compile org.apache.maven.plugins:maven-dependency-plugin:3.9.0:build-classpath -Dmdep.outputFile=target/classpath.txt

Successful compilation creates target/classes, and the dependency goal writes target/classpath.txt. Each tutorial's launch command puts both on the classpath. Start the server in one terminal and the client in another, and the client prints Temperature: 21.5. The two programs run as separate processes so that each one's ownership and shutdown stay visible, and both have explicit shutdown paths.

The shell launch commands use the POSIX classpath separator :. On Windows, use the IDE entry points, or change the separator to ; and read the classpath file with your shell.

When things go wrong

Symptom What to check
Maven cannot resolve the Milo artifacts Check that Maven Central, or your mirror of it, is reachable, and that the version is 1.2.0-RC1.
Java reports an unsupported class version Check the runtime that the launching shell selects, not only the compiler.
The client reports Bad_ConnectionRejected Start FirstServer, or check whether it failed to bind. See Troubleshooting.

Larger examples

The Wiki examples module contains the complete tutorial programs. For larger programs, Examples describes the source examples, their learning paths, and the network precautions their shared ExampleServer needs, because it binds all interfaces and exposes an unsecured anonymous endpoint.

Next steps

Continue with OPC UA concepts, which explains the Nodes, references, and services the tutorials use. If you already know OPC UA, go straight to Your first server.

Related: Your first client · Examples · Client SDK · Server SDK · Contributing

Clone this wiki locally