[2.6.8 Java] Attempting to Build Docker Container of Sub-Project that Depends on Another Sub-Project

17 views
Skip to first unread message

Corwin Brown

unread,
Feb 2, 2018, 12:33:06 PM2/2/18
to Play Framework
Hey everyone!

I hope y'all can help me - I'm not from a Java background, so while I understand the language fine, all of its build tooling is freaking Greek to me.

I have a Play Framework (2.6.9) application that contains 3 sub-projects. An API, a GUI, and common. The ask is for the API and GUI to be separated as much as possible so they can be deployed independently. There's also a desire to deploy it using Amazon ECS and Docker. Before I added that Common module, everything worked amazing. I could build a docker container for each sub-project, as well as the root project, and everything just seemed to work. It was amazing. But now that the API and GUI sub-projects have a dependency on Common, things aren't working. If I try to run the API sub-project, for example, it complains because it can't find the Common module.

Here's my build.sbt file:

Common.settings("IAM")

lazy val common = (project in file("modules/common"))
  .enablePlugins(PlayJava)

lazy val api = (project in file("modules/api"))
  .aggregate(common)
  .dependsOn(common)
  .enablePlugins(PlayJava, DockerPlugin)

lazy val gui = (project in file("modules/gui"))
  .aggregate(common)
  .dependsOn(common)
  .enablePlugins(PlayJava, DockerPlugin)

lazy val root = (project in file("."))
  .aggregate(api, common, gui)
  .dependsOn(api, common, gui)
  .enablePlugins(PlayJava, DockerPlugin)


scalaVersion := "2.11.11"

libraryDependencies ++= Common.commonDependencies



I tried to follow along with this guide that says to use "sbt-assembly" to build a fat jar to accomplish this, but I feel like this should be accomplish-able without heading down that path? Plus, I totally couldn't get it to work :P I kept running into this error:

deduplicate: different file contents found in the following

From what I've read, it's related to the Merge Strategy, and I've gone down a couple rabbit holes here, but I haven't yet stumbled onto the right incantation to make it work.

Hopefully this is an easy problem - I've spent the last decade writing mostly Python, so I'm way out of the loop here.

Thanks for any help you can offer!!!

Will Sargent

unread,
Feb 6, 2018, 1:56:20 PM2/6/18
to play-fr...@googlegroups.com
I don't see why you need sbt-assembly here.  Play already includes sbt-native-packager, which is the important bit.

You should be using JavaAppPackaging, not DockerPlugin.  And I think you want to take DockerPlugin out of root, then publish them individually.

project gui
docker:publishLocal

project api
docker:publishLocal



--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/b8b24d2e-e92b-42c5-a07c-6efe441d3e9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Will Sargent

unread,
Feb 6, 2018, 1:57:25 PM2/6/18
to play-fr...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages