Maven / Java Developer tools

The Java tooling is published to Lightbend’s public Maven repository.

Kickstart

A Maven archetype; maven-archetype-akkasls provides the Kickstart tooling. You supply details such as the desired artifact and group IDs, and the archetype provides a new Maven project directory with the Akka Serverless SDK and associated development support tooling set up.

The archetype is located at Lightbend’s Maven repository. In order to use it, your global Maven settings must be configured to include this repository. Your active profile must be updated to include the following repository definition:

<repository>
  <id>lightbend-akkaserverless</id>
  <name>repo-lightbend-com-akkaserverless</name>
  <url>https://repo.lightbend.com/lightbend/akkaserverless/</url>
  <releases>
    <enabled>true</enabled>
    <updatePolicy>always</updatePolicy>
  </releases>
  <snapshots>
    <enabled>true</enabled>
    <updatePolicy>always</updatePolicy>
  </snapshots>
</repository>

With this configuration in place, the archetype can be used via the mvn CLI.

Linux or MacOS
mvn \
  archetype:generate \
  -DarchetypeGroupId=com.lightbend \
  -DarchetypeArtifactId=maven-archetype-akkasls \
  -DarchetypeVersion=LATEST
Windows
mvn ^
  archetype:generate ^
  -DarchetypeGroupId=com.lightbend ^
  -DarchetypeArtifactId=maven-archetype-akkasls ^
  -DarchetypeVersion=LATEST

Ongoing development support

The development support tooling is provided via a single Maven plugin; akkasls-maven-plugin. This plugin provides two Maven goals to support Protobuf driven interface-first development.

Goals

This plugin implements the following Maven Build Lifecycle goals:

  • generate; generates implementation stubs for your entity/service and corresponding tests, as well as an abstract class for your implementation to extend. If you make further updates to your Protobuf specification after the initial generation, existing implementation is left unchanged but the abstract class is updated to align. This allows you to leverage native developer tooling to guide the desired changes.

  • deploy; simply invokes the akkasls command line tool to deploy the service to Akka Serverless. This relies on an existing installation of the CLI and uses configuration and credentials from that installation.

The deploy goal requires the Akka Serverless CLI to be installed on your system. Download the latest version as described in Setting up the Akka Serverless CLI

Installation

To use the plugin, add the following snippet to the plugin section of your project’s POM:

<plugin>
  <groupId>com.lightbend</groupId>
  <artifactId>akkasls-maven-plugin</artifactId>
  <version>LATEST</version>
  <executions>
  <execution>
    <goals>
      <goal>generate</goal>
      <goal>deploy</goal>
    </goals>
  </execution>
  </executions>
</plugin>

As above, you’ll also need to ensure the project’s POM is configured to include the Lightbend repository. The following snippet should be added to the repositories section.

<repository>
  <id>lightbend-akkaserverless</id>
  <name>repo-lightbend-com-akkaserverless</name>
  <url>https://repo.lightbend.com/lightbend/akkaserverless/</url>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
</repository>

Configuration

The behaviour of the plugin can be adjusted by adding a <configuration> tag to the plugin definition in your POM with any of the following options:

  • akkaslsPath path and name of the akkasls commmand line tool

  • akkaslsContext selects the context when calling akkasls if set

  • dockerImage the Docker image name (use eg. <dockerImage>${akkasls.dockerImage}:${akkasls.dockerTag}</dockerImage>)