If you have the prerequisites installed and are familiar with Maven, create a Hello World project using the procedures on this page. Otherwise, see detailed instructions for help to set up the prerequisites and get started. Prerequisites for using Lagom with Maven include:
- JDK 8
- Maven 3.3 or higher
Maven downloads dependencies and creates the project structure for you. It can take from a few seconds to a few minutes to complete. After confirming the prerequisites, open a console or command window and follow these steps:
Create a new directory for your project.
-
Change into the new directory and enter the following (all on one line):
mvn archetype:generate -DarchetypeGroupId=com.lightbend.lagom -DarchetypeArtifactId=maven-archetype-lagom-java -DarchetypeVersion=1.3.6 -
Maven prompts you for:
-
groupId— typically something like com.example. -
artifactId— becomes the top-level folder name, for example, my-first-project. -
version— the version for your project, press Enter to accept the default. -
package— defaults to the same value as thegroupId
-
-
Enter
Yto accept the values. Maven creates the project. -
Change into the top-level project folder and run it:
mvn lagom:runAllThe
runAllcommand takes a bit of time. It starts Hello World microservices and registers them in a service directory. It also starts a Cassandra server and a web server. -
When you see the message, `Services started, ...`, verify that the services are indeed up and running by invoking the
helloservice endpoint from any HTTP client, such as a browser: http://localhost:9000/api/hello/WorldThe request returns the message
Hello, World!.
Congratulations! You've created and run your first Lagom system. See the documentation to understand your new project.