简体   繁体   English

如何创建Lagom项目的可执行jar

[英]How to create an executable jar of a Lagom project

My project has one service (api and impl). 我的项目有一项服务(api和impl)。 How do I create an executable jar for my service. 如何为我的服务创建可执行jar。 Since Lagom uses the service locator and service gateway for managing services, they need to be included in the jar as well. 由于Lagom使用服务定位器和服务网关来管理服务,因此它们也必须包含在jar中。

To create an executable jar, use sbt-assembly . 要创建可执行jar,请使用sbt-assembly Since Lagom is built on Play, the Play sbt-assembly instructions may be useful here. 由于Lagom是基于Play构建的,因此此处的Play sbt-assembly说明可能有用。

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. 您可以捆绑所需的服务定位器的任何实现,如果您只有一个服务,则不需要任何服务定位器,因为该服务不会查找任何其他服务,您只需提供一个ServiceLocator每次查找都返回None实现。 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. 就服务网关而言,您不能将服务网关捆绑在服务内,因为这样做无法达到目的-服务网关是一个HTTP代理,位于许多服务的前面,并将请求路由到许多服务。 Typically you would use nginx or haproxy. 通常,您将使用nginx或haproxy。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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