As outlined in the development environment introduction, all Lagom services defined in a build can be run with a single task:
runAll. When executing this task, an embedded Service Locator is started, an embedded Cassandra server is also started, and then all your services are started, in parallel. Furthermore, all started services will be running in hot-reload mode. Hot-reload means that the services are automatically reloaded on every change you make, so that you don’t have to manually restart them.
Most times, the
runAll task will serve you well. However, there will be occasions when you may want to manually start only a few services, and this is when the
run task will come in handy. The
run task is available to each of your Lagom service implementation projects.
In Maven, you can execute the
run task on a particular service by using the maven project list flag, like so:
$ mvn -pl <your-project-name> lagom:run
In sbt, you can specify the project to run on the sbt console by simply prefixing the service project’s name, i.e.,
One thing you should remember is that
run only starts the specific service, it doesn’t start neither the Service Locator, nor the Cassandra server. Hence, prior to manually starting services, you may want to manually start both the Service Locator, and the Cassandra server.