简体   繁体   中英

How to create an executable jar of a Lagom project

My project has one service (api and impl). How do I create an executable jar for my service. Since Lagom uses the service locator and service gateway for managing services, they need to be included in the jar as well.

To create an executable jar, use sbt-assembly . Since Lagom is built on Play, the Play sbt-assembly instructions may be useful here.

You can bundle whatever implementation of the service locator you like, if you only have one service though, then you don't need any service locator since that service isn't going to be looking up any other services, you can just provide a ServiceLocator implementation that returns None for every lookup. And as far as a service gateway goes, you can't bundle a service gateway inside a service since that defeats the purpose - a service gateway is an HTTP proxy that sits in front of and routes requests to many services. Typically you would use nginx or haproxy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM