Question

I am experimenting with a small Scalatra web application, which I have imported as a project into Eclipse.

I have used Eclipse to manage a few Lift applications before. With a Lift project, SBT copies all the dependency JAR's to a /lib_managed directory. I can therefore add those JAR's to Eclipse's build path, and it co-exists with SBT just fine without complaining about missing classes.

With Scalatra, however, the dependency JAR's don't seem to get copied anywhere helpful during the development cycle. If you build a WAR file, then the dependencies get bundled up into that... but there doesn't seem to be anything like Lift's /lib-managed directory.

Assuming that anyone else uses Eclipse in developing Scalatra projects, how might I easily set up Eclipse's build path? I suppose that I could manually create entries that point my local Ivy repository one-by-one, although that seems a bit ugly. Perhaps there's an easy way through SBT to setup something similar to Lift's /lib-managed subdirectory inside the project directory.

Was it helpful?

Solution

It looks like the best approach for this is using the SBT plugin for Eclipse.

This is not an "Eclipse plugin" for managing SBT. Rather, it's an "SBT plugin", for generating the .project and .classpath files used by Eclipse. The Maven world used to deal with Eclipse in a similar manner, before the m2eclipse Eclipse plugin reached maturity over the past couple years.

With this plugin installed (I installed it globally so I wouldn't have to change my project's files), you just type sbt eclipse after any changes to your dependencies. SBT will then update your Eclipse project files to match.

OTHER TIPS

You could also use my Maven prototype, then simply import the maven project into Eclipse. Quite nice and you're not forced to use SBT.

https://github.com/fancellu/scalatra-maven-prototype

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top