Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency Management with Play 2.0 Applications

Our group is somewhat new to JVM based development. We are developing applications that are composed of many other libraries.

We find the Play framework to be very appealing for developing web applications. The framework is great, but the dependency management for our locally developed libraries is somewhat vexing. We're using the RC2 of Play 2.0 , and while we are capable of getting changes in our libraries loaded into Play, it is definitely an awkward process that interrupts the normally smooth Play process.

What we are doing is pushing our libraries to our local (on each developer's machine) Maven repository and then importing those same libraries back into the Play project. It works, but as I said, it's awkward.

Are there any best practices that we should be employing that will make this work a little more smoothly?

FWIW, we're using IntelliJ 11.0 (Ultimate)

============EDIT============

I'm getting good answers about how to improve my Maven build process, and I do appreciate that. However, this is not quite the answer that I am looking for.

To make this concrete, assume that I am building both a Service and a Web Application for monitoring/managing the service. The Service is a plain Java/Scala project and the Web App is a Play! project. We'll call these 'Service' and 'App'. (Please don't nitpick about this proposed structure, I'm simplifying it for the purposes of the question)

In Eclipse or IntelliJ, I can add the 'Service' Module (or Project for Eclipse) as a dependency of the 'App' project. This allows very fast developer turnaround when making changes in the 'Service' library (for example, I add a property to a model). Recompile and run is a couple of orders of magnitude faster than compile, package, deploy, import, and reload browser.

Based upon my reading of the Play 2.0 and SBT documentation, my only real answer is to make 'Service' a sub project of 'App'. Is there a better answer to this?

like image 915
Andy Davis Avatar asked Nov 05 '22 05:11

Andy Davis


1 Answers

You have 2 options.

The first one, as Rich mentioned, is a local repository. That doesn't mean the local folder in your dev machine that maven creates as a local cache and you are using. It means a central server in your LAN where you store the versions of the applications for Play to retrieve later on. Nexus, as recommended by Rich, is a great option.

The second option is to simply build your jars and deploy them as unmanaged libraries in your "lib" folder. You can then commit that to your source-management system and all devs will have the same.

I recommend the first approach, much better long term, but it's your choice.

EDIT ON COMMENT you say that you don't want to manage dependencies. The only 3rd scenario I can imagine is that you want to have all the code as a block. In that case you can use subprojects. I don't see other alternatives.

like image 145
Pere Villega Avatar answered Nov 27 '22 13:11

Pere Villega