Developing with 2.8.0-SNAPSHOT
Добрый день -- я очень рад, что русская компания -- лидер в мире Явы и Скалы! Молодцы! Greetings -- first of all, I'm very proud that a company with R&D based in St. Peterbsurg is a leader in Java and hopefully now Scala IDE world. I've avoided Java for its verbosity for many years, preferring OCaml and Ruby. Now I'm doing a Scala project and use it as a way to learn the Java world -- so far I've hit my head against the Maven wall a few times. Since many folks recommend IntelliJ, I checked it out and was happy to find my compatriots being leaders. Also, I understand the idea of creating a perfect virtual world for development. I've looked at Eclipse a few times and it struck me as counter-intuitive. IDEA is also very complex and many things are not intuitive. Hopefully you guys can advise on the good ways in.
Now my attempt to start a Scala project in IDEA were for an existing 2.8.0-SNAPSHOT based one with Maven. Since maven-scala-plugin uses a dependency on scala-library, and that depends on scala-compiler, I didn't have an explicit scala-compiler dependency in my pom... When I tried to build the project, it said I need to attach scala-compiler jar to any module. It was not clear to me where I do that, right-clicking on the top folder showed Module Settings submenu, and that let me see Libraries. I manually created a library Maven: org.scala-tools...scala-compiler:2.8.0-SNAPSHOT and browsed to it. A few moments later I got a compiler internal error, showing Scala lacks some types -- which led me to think it doesn't do 2.8 well, since in command line mvn compile works just fine.
Now for that project, I didn't have the Scala plugin yet. I added it after creating the project, and then it detected a Scala facet, which I agreed to add. So I just deleted the project -- removing files .i{ml,ws,pr}, and reimported it again (external model => maven), after editing pom.xml going back to Scala 2.7.5. OK. Now Make starts, and finds some warnings -- nice -- and then an internal error again. Приехали.
So -- why all these internal errors? How can I report their offending causes? Also, I'd really appreciate a very thorough and detailed user guide -- documentation seems not to have one? I don't need ny flash animation or cartoons, I need a big, detailed PDF manual, if there's one!
Cheers,
Alexy
Please sign in to leave a comment.
Hello, Alexy.
Thank you for kind words. Usually `internal compiler error' in Scala projects means that there are some inconsistencies between used version of Scala compiler and attached libraries. Are you sure you didn't have libraries from scala-2.8.x disptribution together with ones provided by scala-2.7.5? Little test project to reproduce this error would be very helpful. As for scala-2.8 in general, it's not supported yet since there are some significant semantic changes in compiler itself. By them I mean extraction of several important language entities into package objects and introduction of named parameters.
All error repors are welcome in our JIRA bugtracker: http://www.jetbrains.net/jira/browse/SCL.
We also have a short how-to guide and list of implemented features here: http://www.jetbrains.net/confluence/display/SCA/Scala+Plugin+for+IntelliJ+IDEA
With best regards,
Ilya
So let me get it straight -- when I had a 2.8 only project, with all jars compiled under 2.8, I got an error with a missing method. Does it mean that 2.8 is not yet supported for projects? I was reading this forum and saw you develop the plugin itself in 2.8... But the project is only supported if it's in 2.7.x?
Indeed, when I recompiled the project itself under 2.7.5, some of the dependencies remained under 2.8. Stand-alone compilation complained about that, but IDEA just bailed with internal error.
Cheers,
Alexy
OK -- now I specified the dependency on scala-compiler explicitly in the pom, and the project builds under 2.8.0-SNAPSHOT! Still when I try to run it, I get an error for a missing class:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Seq$Projection
at org.jetbrains.plugins.scala.compiler.rt.ConsoleRunnerUtil.listOf(ConsoleRunnerUtil.scala)
at org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner.main(ConsoleRunner.java:20)
Caused by: java.lang.ClassNotFoundException: scala.Seq$Projection
-- this happens for a Scala Console in run configuration. Can we do a Scala 2.8 REPL or not yet?
Cheers,
Alexy
It seems that you're not. The reason is that our ConsoleRunner compiled under 2.7.5. And this uses Seq$Projection, which possibly excluded from scala-library. Problem is that we run our ConsoleRunner under your compiler libraries.
I can suggest you to try to add missed classes to classpath, but I'm not sure that it will work, or you can add fake module with one empty scala-class with 2.7 scala compiler, but I'm also not sure that it will work. I'll try to do it compatible with both versions (2.7, 2.8), but not in next update.
Best regards,
Alexander Podkhalyuzin.
Alexander -- thanks for the clarification, that's what I suspected. As Jorge Ortiz confirmed projections became "views" in 2.8.
So I tried a few workarounds, like giving the same main class as in "scala" wrapper to an Application run configuration, but IDEA can't find it in the project.
What additional functionality does Scala Console have compared to a simple Application with the main class of scala REPL, scala.tools.nsc.MainGenericRunner?
Also, when installing plugins, I grabbed both Scala, 0.2.24703 now, and Scala Application runner, 0.2.2. The latter seems from December of 2008 so I suspect it should not have my latest 2.8 compatibility anyway... Do I need the "runner" for anything?
BTW, are you guys ever on #scala IRC channel? We praise you all the time there and won't mind asking a few questions sometimes!
Cheers,
Alexy
There are runners.jar in the plugin libs. this is jar for running Scalac, ScalaConsole, ScalaTest and Specs.
All of them has minimal additional functionality. What about ScalaConsole it's just wrapper for class: scala.tools.nsc.InterpreterLoop. It's read from System.in and write to System.out without any changes.
You can downlad our plugin sources and look for two files in Runners module: ConsoleRunner.java and ConsoleRunnerUtil.scala. If you recompile them both as you want (for 2.8.0) and replace them in runners.jar, I think it will work.
ScalaApplication runner it's not our plugin. This was just for running classes like: object App extends Application. Now this work well in our plugin too, so you don't need ScalaApplucation runner plugin.
I don't read #scala IRC channel, I just little read scala-internals and scala-tools distributions.
Best regards,
Alexander Podkhalyuzin.
Hi Alexy.
Could you explain, what is the point of development via 2.8 which is quite ustable now. Both specs and ScalaTest frameworks cannot be build now using Scala 2.8 (checked by Jorge himself ).
Usually I skim #scala channel and I'm available there as ilyas. Any questions are welcome.
With best regards,
Ilya
Илья -- привет! Surely -- I started hanging out in #scala and several things I wanted to do turned out to be bugs fixed in trunk. Paul Phillips does a terrific job quashing bugs and overhauling the trunk -- after you see what he does. you kinda don't want to stay with 2.7.x. <TAB> completion now works in the trunk REPL offering possible methods -- really cool.
So far my small project -- with actors -- works just fine under 2.8.0-SNAPSHOT which I build every few days with git pull locally -- the process is described in my Scala blog at http://la.scala.la/ (search for maven).
I also get the named and default parameters, which affects my APIs -- since I deal with Twitter, it's great in implementing their many optional parameters to RESTful calls.
Overall I just don't see the point to sit in 2.7.x if 2.8 works for me already. Now that I learned that I can run a text-mode app just like any (Java) Application, I can even run it all from IDEA! Not only it all works in Maven, it already works in IDEA! Some of the suggestions for name resolution are way off, but not too many. I used to work with text editors, but now start to like the GUI -- awesome job!
Cheers,
Alexy
OK -- I've updated the Scala plugin to the latest one (0.2.25240), and now get an internal error where before my stuff compiled well (attached). It compiles fine under raw Maven.
Does it mean 2.8.0-SNAPSHOT cannot be built with Make anymore?
Cheers,
Alexy
Attachment(s):
idea-scala-internal-error.txt