You can use Maven or sbt to build services you create with the Lagom Java API. - (If you aren’t using one of these tools already, see this information to - help you choose - between sbt and - Maven.) The Lagom development environment runs on Windows, Mac, and Linux operating systems. - Try it from the command line to get started and later integrate your - project into an IDE. Maven and sbt plugins make it especially easy to integrate the Lagom development environment with Eclipse or IntelliJ IDEA.
- -The following screen shows a successful run of the Lagom development - environment with Maven: -
- -
- - - -
+ The following screen shows a successful run of the Lagom development environment with Maven: +
+Using Lagom with Java and Maven
@@ -79,66 +64,93 @@
Using Lagom with Java and Maven
- If you have the prerequisites installed and are familiar with Maven, - create a Hello World project using the commands below. Otherwise, see detailed instructions - for help setting up the prerequisites and getting started. + If you have the prerequisites installed and are familiar with Maven, create a Hello World + project using the commands below. Otherwise, see + detailed + instructions for help setting up the prerequisites and getting started.
-
-
+
From a command prompt, create a new project by entering the following (all on one line): - +
-
+mvn archetype:generate -DarchetypeGroupId=com.lightbend.lagom -DarchetypeArtifactId=maven-archetype-lagom-java -DarchetypeVersion=1.3.0
mvn archetype:generate -DarchetypeGroupId=com.lightbend.lagom -DarchetypeArtifactId=maven-archetype-lagom-java -DarchetypeVersion=@context.currentLagomVersion
-
-
- Maven prompts you for:
-
- The number corresponding with the lagom archetype, at this time only one is available, enter the number
1
to select it.
- - The Lagom version, press Enter to accept the default. -
groupId
— becomes the package name, typically something like com.example.com.
- 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
-
- The number corresponding with the lagom archetype, at this time only one is available, enter the number
- Enter
Y
to accept the values. Maven creates the project and downloads all of the necessary dependencies.
+ -
+
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
+Y
to accept the values. Maven creates the project. + -
Change into the top-level project folder and run it:
-
-mvn lagom:runAll
The
- +runAll
command starts Hello World microservices and registers them in a service directory. It also starts a web server, which enables you to test the microservices immediately.
+ +mvn lagom:runAll
+ The
+runAll
command starts Hello World microservices and registers them in a + service directory. It also starts a web server, which enables you to test the + microservices immediately. +
+ -
+
+ Verify that the services are indeed up and running by invoking the
+ +hello
+ service endpoint from any HTTP client, such as a browser: + http://localhost:9000/api/hello/World ++ The request returns the message
Hello, World!
. +
- - Verify that the services are indeed up and running by invoking the
hello
service endpoint from any HTTP client, such as a browser: - - -http://localhost:9000/api/hello/World
- - The request returns the messageHello, World!
.
-
Maven prompts you for:
+-
+
Congratulations! You've created and run your first Lagom system. - See the documentation - to understand your new project.
- - + +- + Congratulations! You've created and run your first Lagom system. See + the + documentation to understand your new project.
+ @* ++ +
+ *@ +- +
Using Lagom with Java and sbt
@@ -151,44 +163,75 @@
Using Lagom with Java and sbt
- If you have the prerequisites installed and are familiar with sbt, follow the steps below. Otherwise, see detailed instructions - for help setting up the prerequisites and getting started. + If you have the prerequisites installed and are familiar with sbt, follow the steps below. + Otherwise, see + detailed + instructions for help setting up the prerequisites and getting started.
--
-
- - From a command prompt, create and run a new project by entering the following: - - -
- The sbt Lagom template prompts for the following parameters. Press
Enter
to accept the defaults or specify your own values: --
-
name
- Becomes the name of the top-level directory.
- organization
- Used as a package name.
- version
- A version number for your system.
- lagom-version
- The version number of Lagom. Be sure to use the current stable release
When you finish, sbt downloads all of the project dependencies.
-
-
- - Change into the top-level directory of the project you just created. For example, if you used the default name,
hello
: -cd hello
-
- - Start sbt and the Lagom development environment:
-
sbt runAll
- - Verify that the services are indeed up and running by invoking the
hello
service endpoint from any HTTP client, such as a browser: - + +-
+
-
+
+ From a command prompt, create and run a new project by entering the following: +
+ +
+sbt new lagom/lagom-java.g8
+ -
+
+ The sbt Lagom template prompts for the following parameters. Press
+Enter
to + accept the defaults or specify your own values: +-
+
-
+
name
- Becomes the name of the top-level directory. +
+ -
+
organization
- Used as a package name. +
+ -
+
version
- A version number for your system. +
+ -
+
lagom_version
- The version number of Lagom. Be sure to use the current + stable release (@context.currentLagomVersion) +
+
+ -
+
-
+
+ Change into the top-level directory of the project you just created. For example, if you + used the default name,
+hello
: +
+cd hello
+ -
+
+ Start sbt and the Lagom development environment: +
+
+sbt runAll
+ -
+
+ Verify that the services are indeed up and running by invoking the
+ +hello
+ service endpoint from any HTTP client, such as a browser: + http://localhost:9000/api/hello/World ++ The request returns the message
+Hello, World!
. +
+
-
- The request returns the messagehttp://localhost:9000/api/hello/World
+ Congratulations! You've created and run your first Lagom system. See + the + documentation to understand your new project.Hello, World!
.
- -
+
sbt new lagom/lagom-java.g8
-
- Congratulations! You've created and run your first Lagom system. See the documentation - to understand your new project.
- -Using Lagom with Scala
Prerequisites for using Lagom with Scala: @@ -29,40 +28,71 @@
Using Lagom with Scala
If you have the prerequisites installed and are familiar with sbt, - follow the steps below. Otherwise, see detailed instructions - for help setting up the prerequisites and getting started. + follow the steps below. Otherwise, see + detailed + instructions for help setting up the prerequisites and getting started.
--
-
- - From a command prompt, enter the following to create a new Lagom project: - -
- The sbt Lagom template prompts for the following parameters. Press
Enter
to accept the defaults or specify your own values: --
-
name
- Becomes the name of the top-level directory.
- organization
- Used as a package name.
- version
- A version number for your system.
- lagom-version
- The version number of Lagom. Be sure to use the current stable release
When you finish, sbt downloads all of the project dependencies.
-
-
- - Change into the top-level directory of the project you just created. For example, if you used the default name,
hello
: -cd hello
-
- - Start sbt and the Lagom development environment:
-
sbt runAll
-
- - Verify that the services are indeed up and running by invoking the
hello
service endpoint from any HTTP client, such as a browser: - +-
+
-
+
+ From a command prompt, enter the following to create a new Lagom project: +
+ +
+sbt new lagom/lagom-scala.g8
+
+ -
+
+ The sbt Lagom template prompts for the following parameters. Press
+Enter
to + accept the defaults or specify your own values: +-
+
-
+
name
- Becomes the name of the top-level directory. +
+ -
+
organization
- Used as a package name. +
+ -
+
version
- A version number for your system. +
+ -
+
lagom_version
- The version number of Lagom. Be sure to use the current + stable release (@context.currentLagomVersion) +
+
+ -
+
-
+
+ Change into the top-level directory of the project you just created. For example, if you + used the default name,
+hello
: +
+cd hello
+ -
+
+ Start sbt and the Lagom development environment: +
+
+sbt runAll
+ -
+
+ Verify that the services are indeed up and running by invoking the
+ +hello
+ service endpoint from any HTTP client, such as a browser: + http://localhost:9000/api/hello/World ++ The request returns the message
+Hello, World!
. +
+
-
- The request returns the messagehttp://localhost:9000/api/hello/World
+ Congratulations! You've created and run your first Lagom system. See + the + documentation to understand your new project.Hello, World!
.
- -
+
sbt new lagom/lagom-java.g8
-
- Congratulations! You've created and run your first Lagom system. See the documentation - to understand your new project.