Multi-project Play applications in IntelliJ

Hi all.

I’m using IntelliJ to develop a Play application. The application has several maven dependencies developed in house, some of them being marked “SNAPSHOT" meaning I want to see changes made in them immediately.

Now. When I make changes to the SNAPSHOT dependencies in IntelliJ, my Play Application doesn’t pick them up undil I build and install the modified artifacts (using maven) and trigger an SBT-build of the Play project. Otherwise the application doesn’t see my changes.

Is there any way for my Play application to resolve dependencies locally, without me having to do an install and build every time I modify one of the maven projects?

Cheers,
- hugi

PS: For those familiar with the Eclipse way of thinking, that’s kind of what I’m looking for. There I can split my project up into multiple modules and have Eclipse worry about resolving my dependencies in the workspace.

5 comments
Comment actions Permalink

Hello,
sorry for late response, I've missed your quiestion.

Do you have these dependencies as modules in the same project or they are in different project(s)?
Do you have your play project imported in IDEA via our SBT support? If yes (and if I get all correctly) you can add built locally artifacts to unmanagedJars dependency in build.sbt

0
Comment actions Permalink

Hi,
thanks for your reply!

The play (2.4) project is imported via the sbt-support and the dependencies are different projects (mavenized, unrelated open source projects).

So do I understand correctly; that I have to copy the jar into /lib, and make my maven build copy the new jar file there after each modification to the code?

0
Comment actions Permalink

If you have these dependencies in separate projects, you have to build jars anyway to see changes in IDEA in your play project. But you can add any other project as a different module in IDEA

0
Comment actions Permalink

OK, if I add the project as a module to my project, can I then see the changes immediately? Having to rebuild the third party jars every time I modify them seems a little inconvenient.

Perhaps my question should rather be; "what is the easiset way to work on multi module projects in IntelliJ, without having to recompile in between changes". I.e., how would you go about it?

One idea: If I keep Eclipse running in the background (with the dependency project open and it's incremental compiler thus doing work on it), can the classes folder live in the "lib" directory, or does the lib directory anly accept packaged jars?

Thanks for all your help!

0
Comment actions Permalink

Yes, it would help as these projects become same as source roots for IDEA (you can read more in these comparison https://www.jetbrains.com/idea/help/project-configuration.html).  However I should notice these projects should be added as sbt subprojects in your buld file since IDEA project structure is overwritten during sbt refresh.

.class files can be added as lib in IDEA, but I'm not sure if sbt build descriptor can handle it (library dependencies are overwritten during sbt refresh as well)

Do you invoke sbt refresh often on your project, i.e. how often do you modify build.sbt?

0

Please sign in to leave a comment.