Scala version of Jgit - scala

Looking for a stable Scala implementation (or something similar) of JGit.
Has anyone worked with anything like it?
I've found scala-git but it's not what I'm looking for.

I did the same search some time ago, but I concluded that it was preferable to use JGit (even if it's a Java library) in Scala. It's used by products with lots of users (eclipse, netbeans, gerrit,...) and even some Scala products like Gitbucket use it.
Its API can be easily called from Scala, and does not result in ugly code, nor needs heavy wrappers.
Personally I prefer using a Java lib widely used than a pure Scala lib for which I don't know the roadmap nor if it's still maintained. I thought to ScalaGit but it seemed really young (only 67 commits) and not actively maintained (last commit on Apr 21, 2014).

Any java library (like jgit) is perfectly usable in scala as scala run in the java runtime environment. Is there any reason why you can't use it?

Related

Is the scala eclipse IDE stable enough?

I use eclipse as my scala IDE. But It seems not so good. I can build my project using maven successfully. But eclipse always warn me there's compilation error. Any has experience of scala eclipse plugin ? Thanks BTW I use scala IDE for 2.8.1
There is a new Eclipse plug-in which is in the final stages of release, currently in beta 4 which offers numerous improvements including stability. It runs with Scala 2.9.
You can download and try it for yourself. More information and download available here:
http://www.scala-ide.org/
Also, be sure to read on improving Eclipse performance, I find a few of these tweaks makes a big difference. Here are some answers on Stackoverflow regarding that:
How can you speed up Eclipse?
What are the best JVM settings for Eclipse?
I've been using all three major IDEs over the last few days for Scala.
Eclipse is pretty good and perfectly useable although you will encounter a few bugs - silly things like you can't load compiler plugins if you have a space in your plugin folder pathname. It also behaved pretty badly a few times and wouldn't run anything until I restarted Eclipse, but this might be partly because I'm new to it and maybe have been doing something wrong. One thing that is good about Eclipse is that the build time is a lot quicker than for the other two - I think this is because it does and "incremental build". Or maybe it's just more optimized, but it's noticeable.
I would recommend trying the latest version of IntelliJ (10.5). It seems to be the best at the moment with the fewest rough edges, and the only one to have Scaladoc support integrated. I haven't used it much but first impressions are good.
The NetBeans plugin seems to be getting left behind a bit (there's only one guy working on it), which is a shame because it has IMO easily the best code editor for Java, with excellent predictive capabilities which you don't get for Scala at the moment. I'll continue to use it for Java, but the Scala plugin development is a bit sparse. (Although it might be because I'm using a beta version, because that's all that's available right now for Scala 2.9.)

What is the purpose of the scala.tools.nsc package?

I've spent a good few hours googling for something to allow me to open Zip files in Scala (I know you can just use the Java API, but I was hoping to find a Scala friendly wrapper for it instead of faffing about writing Buffered/FileInputstream and so on)
So I was just messing about in the REPL and found this package
scala.tools.nsc.io.ZipArchive
Which after some digging and using this scala.tools.nsc.io.File, I managed to open a zip archive with all of the Scala niceness (being able to foreach etc)
The thing is I can't see any mention of this package in the official Scala 2.8.1 API document, so I was just wondering why there's no documentation on it? What is it?
this package contains Compiler-related classes. It's mainly used (as far as I know) for Plugin creation.
Due to it being related to Scala compiler, I'm not sure to which point it is a "stable" package and how much may it change between Scala versions, so be careful there.

Running Eclipse Scala Plugin with previous version of Scala

The scala plugin seems to automatically download version 2.8 of Scala. I'l like to try out the Gridgain 3.0-beta, which currently only works with Scala 2.7.7. Since Gridgain 3.0-beta already provides scala-compiler-2.7.7.jar and scala-library-2.7.7.jar, is it possible to get the Eclipse Scala Plugin to compile to Scala 2.7.7?
I tried removing the Scala Library 2.8 from the project build path and added both the 2.7 jars, but this didn't seem to work.
Would this be easier if I switched to Netbeans?
Both the Eclipse plugin and the NetBeans plugin use the Scala Compiler for a lot of things from the simple stuff like syntax highlighting to stuff like type inference, resolution and display of implicits to more involved stuff like automated type-driven refactorings and semantic highlighting.
And more specifically, they use the 2.8 compiler, because the 2.8 compiler has a completely refactored API and a new framework (the so-called presentation compiler), which is specifically designed for IDEs, so that they can get all the information they need out of the compiler, but also can feed information (like in the case of refactorings) back into the compiler.
So, in short: the version of the plugin is closely coupled to the version of the compiler, and the compiler in turn only supports one version of the language. In particular, the IDE plugins require a 2.8 version of the compiler, because they use the new presentation compiler framework, and the 2.8 compiler does not support the 2.7 language.
This tight coupling is of course not a good thing, and it will get broken up in the future, but for now, you are stuck.
You could try the IntelliJ IDEA IDE and their Scala plugin. As far as I know, they have written their own compiler (well, at least the parts they need for syntax highlighting and refactoring purposes) purely from the Scala Language Specification, without using any of the Scala Compiler APIs. The Scala Plugin does work with the Community Edition.
The best place for questions like this is the Scala IDE user mailing list. But in brief, the Eclipse tooling for Scala doesn't support the use of other versions of the Scala compiler and libraries than the ones which it ships with. This is unlikely to change in the foreseeable future.

Use Scala as if it was Java

I've been reading up on Scala a lot recently and I really want to get into it. I do my Java web development from within Eclipse with Tomcat as my preferred server and I'd like to keep it that way. I've tried the Scala Eclipse plugin but it's safe to say, it isn't there yet. I had to uninstall it because it simply ins't working. On top of that, it doesn't seem to provide anything for doing web projects (I could be wrong there).
Since Scala is a compiled language just like Java is, I was wondering if it's possible to simply swap out Java with Scala, as in, where I'd normally would create Java classes I would now be able to create Scala classes instead? Maybe even mix Java and Scala?
Is there anyone out there who's been able to set up a decent Scala workflow in Eclipse for web development without the dreaded "official" Scala Eclipse Plugin?
PS: I've tried the Play framework (I think it recently added Scala support) but it simply isn't for me. I like my classes compiled and to use JSP's for my views.
You don't say anything about what version of the Scala IDE for Eclipse you were using, or what you tried to do to resolve your issues. I suggest that before changing your workflow you head over to http://groups.google.com/group/scala-ide-user and see if we can help you out.
Since Scala is a compiled language
just like Java is, I was wondering if
it's possible to simply swap out Java
with Scala, as in, where I'd normally
would create Java classes I would now
be able to create Scala classes
instead?
Yes, absolutely. That's one of Scala's big advantages over some other JVM languages.
Maybe even mix Java and Scala?
Yes, absolutely. That's one of Scala's big advantages over some other JVM languages.
Make sure you have familiarity with the Java and Scala collections libraries (and that you keep them straight -- if you're planning using advanced Scala features on Java collections, definitely use a Scala 2.8 release candidate). Also make sure you're faimilar with the #BeanProperty annotation -- it can simplify your Scala coding somewhat.
As Miles said, you should give us the version of Eclipse you are working with.
I'm also new to Scala and found difficult to work through Eclipse. I was using Eclipse Galileo 3.5.2 and found specially long to compile all the scala libraries. I switched to IntelliJ (IDEA 9.0.2) and I'm much more confortable now. I recomend trying it although it's more a personal matter.
Even so, I agree, the plugins are not there yet specially for web development. The great news is that you can use everything you have in Java and mix it with Scala. Since Scala is compiled to Java BitCode, they are totally compatible. See Combining Scala and Java.
When writing in Scala you always have (almost) all the Java libraries at your service plus anything you have created before. You will have to be carefull with the types (i.e. primitive types) but it normally works out very well.

Another Java vs. Scala perspective - is this typical?

I have been reading about Scala for a while and even wrote some small programs to better understand some of the more exoteric features.
Today I decided to do my first "real project", translating some 60 lines of ugly Java code to Scala to rewrite it using the better pattern-matching features (why? because the Java version was becoming hard to maintain due to excessive combination of regex and conditionals).
About halfway through the editing process, Eclipse thew up this error:
alt text http://img269.imageshack.us/img269/1243/errorms.jpg
I get the general impression that the Scala IDE in Eclipse is a lot buggier and less complete than its Java equivalent. Is this correct or do I just have a bad installation? Is there a better IDE for Scala?
I really like IntelliJ Idea Community Edition's Scala support. I've been using it from it's early days. I've also tested Netbeans and Eclipse plugins but I really don't like them that much. Especially all Eclipse Scala plugins are crap. I also tested Textmate Scala bundle, which is very nice but doesn't offer auto completion.
Here is my Scala Ide top list:
IntelliJ Idea Community Edition
Netbeans
Textmate (This is here, since I really like Textmate for writing Rails applications)
Eclipse
When you learn IntelliJ Idea keyboard shortcuts and add some live templates you can be very productive programmer. Furthermore, if you buy the Intellij Idea Ultimate Edition you can even share the settings with multiple computers or with your team.
What I suggest:
Download IntelliJ Idea Community Edition
Install the Scala plugin
Learn the keyboard shortcuts: Windows and Linux, Mac
Configure Live Templates when you get more familiar with the ide
The Eclipse IDE Scala support has not been great for some time, but is now receiving additional development effort alongside the introduction of Scala 2.8, and appears to be improving. For Scala 2.7 I have found the Intellij plugin to be in a better state.
One problem that both of these plugins have is that Scala itself is a moving target - Scala 2.8 has introduced additional syntax and structures to Scala 2.7.
From my own experience with Eclipse, using it for languages other than Java is never quite as good.
You might find this post of interest.
I get the general impression an IDE for a new, young, niche language is a lot buggier and less complete than a widespread, supported, mature language
Try Netbeans. Its plugins are generally of a simpler construction anyway, so should have less 'gotchas'
One point to make is that it is possible that people are still put off IntelliJ because they assume that the licence is expensive, especially if they are happy with Eclipse and are unaware of the Community Edition which is free and open source.
I cannot give any comparison with the other IDEs as I have always used IntelliJ, however the Scala support is certainly good, all things considered, and getting better.
We are using Eclipse Scala plugin at work and working with it is quite terrible. One cannot really trust reported errors inside IDE, runtime exceptions are the order of the day. Our best experience is with build from 25-11-2009.
At home I play with IntelliJ 9 and its Scala plugin and I find it much much better. I am newbie to IntelliJ but I am very impressed with all those little details which (once you get used to them) increase your productivity... a lot.
The drawback is in IntelliJ there is no compile-error reporting on the fly (at the time you're writing code) yet implemented and only Scala up to 2.7 is supported (2.8 by nightly builds only), but there are NO runtime exceptions while working with the IDE. I would recommend you to try IntelliJ, community edition at least.
I never really get on with IDEs at the best of times because they are usually pretty awful at actual text editing, but Eclipse's Scala plugin is particularly brittle to the point that projects "forget" that they are Scala after a while. Battling Eclipse seems to consume more effort than it saves. I just went back to my Emacs and sbt REPL in a terminal.
A light play with IntelliJ confirmed that it does at least do the job as a Scala IDE, but again I didn't care for its editor. It's also commercial software. However, if you are seeking a robust Scala IDE, this is perhaps where you should be looking.
What I have since settled on is perhaps perverse and not for the newcomer, but suits somebody who has definite opinions about their text editor. ENSIME is an editor plugin and server component that adds what you need from a Scala IDE to Emacs. It also claims support for vim, Atom, and Sublime, but I've not tested these. Occasionally it also has a bad day—obscure kinds of macros particularly confuddle it—but it generally does the job.