다음을 목표로 연구중에 있습니다.
|
If you are a Java developer with existing knowledge of Maven, this familiarity can help you get started faster with Lagom. If your organization has existing infrastructure, plugins and best practices built around Maven, that might also make Maven the more practical choice.
sbt is a very powerful build tool that allows Lagom’s features to be very easily supported and implemented - there are many aspects of the Lagom development environment that work a little smoother and faster in sbt than Maven due to sbt’s power and flexibility. For this reason, sbt is the build tool of choice for the maintainers of Lagom.
라곰은 빌드/개발 환경으로 Maven/SBT 둘중하나 선택가능하며, 자바 개발자로서 메이븐에대한 경험이 있으면 이것을 선택하라고 한다.
보통 메이븐 개발환경이 지원받기 편하고, 자바빌드 시스템에 오랫동안 사용되어 마이크로서비스 달성을위해 고통없이 빠르게 사용할것 같지만
실제로는 그렇지않다. 마이크로 서비스를 위한 빌드/배포를 디테일하게 구성한다는것은 메이븐에대한 숙련도가 아주 높아야한다란것이며 ,
오래된 자바개발자도 마이크로 서비스를 위한 개발환경 구성시 애를 먹는다란것이다.
sbt new lagom/lagom-java.g8 |
// 메이븐 pom.xml 파일에 대응 organization in ThisBuild := "com.psmon.lagomtest" version in ThisBuild := "1.0-SNAPSHOT" // the Scala version that will be used for cross-compiled libraries scalaVersion in ThisBuild := "2.12.4" lazy val `hello` = (project in file(".")) .aggregate(`hello-api`, `hello-impl`, `hello-stream-api`, `hello-stream-impl`) lazy val `hello-api` = (project in file("hello-api")) .settings(common: _*) .settings( libraryDependencies ++= Seq( lagomJavadslApi, lombok ) ) lazy val `hello-impl` = (project in file("hello-impl")) .enablePlugins(LagomJava) .settings(common: _*) .settings( libraryDependencies ++= Seq( lagomJavadslPersistenceCassandra, lagomJavadslKafkaBroker, lagomLogback, lagomJavadslTestKit, lombok ) ) .settings(lagomForkedTestSettings: _*) .dependsOn(`hello-api`) lazy val `hello-stream-api` = (project in file("hello-stream-api")) .settings(common: _*) .settings( libraryDependencies ++= Seq( lagomJavadslApi ) ) lazy val `hello-stream-impl` = (project in file("hello-stream-impl")) .enablePlugins(LagomJava) .settings(common: _*) .settings( libraryDependencies ++= Seq( lagomJavadslPersistenceCassandra, lagomJavadslKafkaClient, lagomLogback, lagomJavadslTestKit ) ) .dependsOn(`hello-stream-api`, `hello-api`) val lombok = "org.projectlombok" % "lombok" % "1.16.18" def common = Seq( javacOptions in compile += "-parameters" ) |
hello → Project root └ hello-api → hello api project └ hello-impl → hello implementation project └ hello-stream-api → hello-stream api project └ hello-stream-impl → hello-stream implementation project └ project → sbt configuration files └ build.properties → Marker for sbt project └ plugins.sbt → sbt plugins including the declaration for Lagom itself └ build.sbt → Build configuration |
실행과 배포가 비교적 간단한 명령으로 실행이 가능하며, VisualStudioCode가 자바전용 IDE가
아님에도 불구하고 큰 이질감없이 가벼운 개발환경 구축이 가능
sbt:hello> runAll [info] Starting Kafka [info] Starting Cassandra .......Kafka Server closed unexpectedly. .. [info] Cassandra server running at 127.0.0.1:4000 2018-07-22T03:15:20.723Z [info] akka.event.slf4j.Slf4jLogger [] - Slf4jLogger started 2018-07-22T03:15:24.777Z [info] com.lightbend.lagom.discovery.ServiceLocatorServer [] - Service locator can be reached at http://localhost:9008 2018-07-22T03:15:24.778Z [info] com.lightbend.lagom.discovery.ServiceLocatorServer [] - Service gateway can be reached at http://localhost:9000 [info] Service locator is running at http://localhost:9008 [info] Service gateway is running at http://localhost:9000 |
sbt:hello> dist [info] Packaging D:\project\sbt\hello\hello-stream-impl\target\scala-2.12\hello-stream-impl_2.12-1.0-SNAPSHOT-sources.jar ... [info] Packaging D:\project\sbt\hello\hello-impl\target\scala-2.12\hello-impl_2.12-1.0-SNAPSHOT-sources.jar ... [info] Done packaging. [info] Done packaging. |