How to build/test Scala without IDE dependence?
Asked Answered
P

5

5

I'm well into learning Scala now and enjoying it very much; I hope to start future projects in it, rather than Java. What I'm enjoying less is the (relatively) poor IDE support. I've found both IDEA and Eclipse with the Scala Plugin (including nightly builds) to be a bit unreliable or difficult to use - I want something I can always depend on. E.g. yesterday I couldn't get a fresh install of eclipse+plugin to run my tests at all, or even open an editor window!

I'm considering hopping between Eclipse/IDEA depending on which suits the task at hand best and more importantly cutting my dependence on the IDE for building and running tests (ScalaTest). This is non-trivial for me since I've grown up on Java in Eclipse; leaving Eclipse SVN to use GIT was initially a big deal. Given that I only have time to learn one tool, should it be Ant, Maven, buildr, sbt,.... ? How do other people work?

Packaging answered 16/9, 2010 at 7:0 Comment(0)
A
10

I have used both Maven and sbt with Scala and found both of them pretty easy to use.

However, sbt feel much more closer to Scala as its build files are written in Scala itself (as opposed to XML in Maven) and sbt feature a build REPL, has continuous compilation and testing etc.

So I would advise you to use sbt for a simple Scala project.

But in case you want to create standard Java projects like WAR, EJB etc, I feel like Maven has a better support for them.

Also Maven has an enormous plugin ecosystem which enables you to do virtually everything, code coverage, reporting, code standard checking, documentation generation, and a lot more.

Arms answered 16/9, 2010 at 7:8 Comment(0)
A
3

I'd use SBT with IDEA. Though I haven't tried it, I know there's some support for integration of SBT and IDEA.

Anyway, SBT is a great basis for all Scala building&testing needs.

Annecy answered 16/9, 2010 at 23:48 Comment(1)
SBT and IDEA integration is better than it has ever been. It's fantastic!Should
U
1

EDIT: Uuuups. Sorry. Actually I misread your question and only commented on IDEs. When it comes to building the project I use make ;) because it is well integrated into Vim

while I wouldn't want to do ANY Java Project without IDE, I'm currently doing a fairly large project just in Vim. I know that's a quite a "stone-age approach" but it works just fine.

On one hand I was fed up by the buggy/slow/lacking Scala support of all IDEs. I tried Scala, netbeans and IDEA and found working with them (in Scala) rather painful.

On the other hand Scala has some properties that help when working with a simple Editor: you can have more classes in one file so I usually define a whole package in one file which again doesn't grow too large, since Scala class are usually very (or even extremely) small. So I usually have only two or three files open at a time and hence don't need a package/file management.

I couldn't get code folding by languages tags to work but folding by indentation works just fine if you stick to Scala's indentation conventions.

One thing that doesn't work is auto-completion. But then again, this makes me write more loosely coupled objects ;)

Upperclassman answered 16/9, 2010 at 9:25 Comment(4)
Good to hear of a more 'hardcore' approach :) The thing that would worry me about the it would be re-factoring. I don't usually get things right first time round and depend on re-factoring a bit more than perhaps I should.Packaging
Along these lines, I've heard that emacs + sbt + ENSIME is a good combo (and ENSIME does refactoring!). More on this scala-user thread: scala-programming-language.1934581.n4.nabble.com/…Ineffective
@Pengin: as if written above, I tend to write more loosely coupled class systems due to the lack of auto completion. So usually refactoring takes me about 5 minutes or lessUpperclassman
@Upperclassman - There's nothing stone-age about vanilla vim. Plenty of Python and C++ developers (myself included) are actually entirely ok going that route. Increasingly I see JS UI guys using vanilla vim instead of Sublime as well. I think the JVM languages largely find themselves within IDEs because of the way they handle all of the classpath configuration for your project for you.Keffer
F
1

Buildr supports Scala and Java as first class languages, with support for ScalaCheck and ScalaSpecs, and of course also has enough plugins to make it a good contender for Maven.

Frisian answered 30/9, 2010 at 6:2 Comment(0)
W
0

Just adding my two cents. I think you should give Netbeans a try too. Its supposed to be the most Scala-friendly among the three major players (Eclipse, Idea and Netbeans).

I have been having a lot of fun with Netbeans 6.8 and scala-2.8.0.r22602-b20100720020114

It is fair to say that I wouldn't be programming Scala now if it hadn't been for the Netbeans plugin. I have spent a fair bit of time trying to get it to work as smoothly with the others, but without much success.

I use Netbeans for developing and Ant for standalone build. Info on configuring Ant for Scala here: http://scriptlandia.blogspot.com/2007/04/how-to-compile-and-run-scala-program.html

Woodcut answered 1/10, 2010 at 17:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.