Play JAR as subproject

47 views
Skip to first unread message

Milgo

unread,
Aug 6, 2015, 8:11:10 AM8/6/15
to play-framework
Hey guys,

I'm working with multiple Java Play projects and I want to work with my subproject in a different way than I do now but I don't know how to do that.
I'm working with three projects, let's call them A, B and Sub. Sub is my subproject and it used in A and B in a different way, but both projects need Sub. At the moment, I have two times the code ob Sub in [A-Project]/modules/sub and in [B-Project]/modules/sub. Twice the same code which needs to be synchronized.
I'd like to pack my subproject just in an archive like a JAR-file and include it in both projects A and B as a library. Is there a way to do that or do I have to work with two different folders for the same project? :/

Thank you for your help!

Milgo

unread,
Aug 27, 2015, 1:16:32 PM8/27/15
to play-framework
Still having that problem.

I still want to use an subproject that's packed into a JAR file, is there a way to use it in a build.sbt like:

lazy val sub = project.in(file("lib/subproject-SNAPSHOT.jar"))
   
.enablePlugins(PlayJava, PlayEbean)

This gives me an error message, that the path is no directory (well, that's right). Is there a way to use a subproject in a JAR file?

lee.wa...@anevis-solutions.com

unread,
Aug 28, 2015, 6:02:28 PM8/28/15
to play-framework
Have you tried just including it as a library in built.sbt? Something like:

libraryDependencies ++= Seq(
  "org.yours" % "your-artifact" % "1.0.0"
)


You can publish your subproject's .jar to your local ivy repo with 'publishLocal' or 'publishM2' (if you want in it your local maven repo) from the activator prompt. Then it should be found by your dependency declarations in by your A and B build.sbt as above.
Reply all
Reply to author
Forward
0 new messages