EzDevInfo.com

scala-ide

Scala IDE for Eclipse Scala IDE for Eclipse

How can I use Eclipse to debug tests driven by sbt?

I have a set of test cases that I want to debug (step by step, reading values, etc.). How can I setup my sbt build so that I can hookup an eclipse debugger?


Source: (StackOverflow)

JDT weaving is currently disabled

I just installed Eclipse standard 4.4 Luna, and after installing the Scala IDE and friends I get

JDT Weaving is currently disabled. The Scala IDE needs JDT Weaving to be active,
or it will not work correctly. 

Activate JDT Weaving and Restart Eclipse? (Highly Recommended)

[OK] [Cancel]

Does anyone know how to do this?

Now my comments on this error message

  • In general error messages that tell you what to do, but not how to do it are frustrating.
  • The [OK] button implies that the dialog will enable it for me, but it does exactly the same as clicking the [Cancel] button. Consequently, the UI design is defective.
  • The preferences dialog in Luna does not show anything under JDT or Weaving.
  • The help search in Luna for "JTD Weaving" returns too much information to offer any simple solution.
  • My search via Google turns up interesting discussion on the problem, but fails to simply state the solution, or if there is one.

https://groups.google.com/forum/#!msg/scala-ide-user/7GdTuQHyP4Q/aiUt70lnzigJ


Source: (StackOverflow)

Advertisements

Using SBT from Scala IDE

The path from SBT to Scala-IDE is well described in many places:

  1. Start with an SBT project
  2. Add the SBT plugin definition: addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
  3. Run the 'eclipse' command from within SBT
  4. Open Eclipse with an installed Scala-IDE add-on
  5. Import the project

What is the reverse for this? If I start a new project in Scala-IDE, can I just add a build.sbt file and somehow tell Eclipse to use this when running the application?

Apologies if this seems obvious to some, but I've recently moved from ItelliJ Idea to Scala-IDE and I'm not certain about setting up Scala-IDE to use SBT and my sbt config files.


Source: (StackOverflow)

Errors in Eclipse for Scala project generated by Play Framework

I would like to use Eclipse as IDE for a Scala web application using Play Framework. I downloaded Eclipse 3.6.2. Then I installed Scala IDE 2.0 (beta) for Eclipse. I downloaded Play Framework 1.2.2RC1 and installed the Scala Module using play install scala-0.9.1 and generated a new site with play new mysite. Then I eclipsified it with play eclipsify mysite and imported the project in Eclipse.

But now I get many errors in Eclipse. Is this anything I can fix or are the different projects incompatible?

This is the generated code that contains errors in Eclipse (but it works when I run the application).

package controllers

import play._
import play.mvc._

object Application extends Controller {

  import views.Application._

    def index = {
        html.index("Your Scala application is ready to go home!")
    } 
}

And this is how it looks like in Eclipse:Scala Play application in Eclipse


Source: (StackOverflow)

Run SBT Task from Eclipse

I am using SBT as a build manager, and Eclipse as my IDE, or at least I want to. The problem is more, how do I run specific SBT tasks from Eclipse. I have properly exported the project to Eclipse, and Eclipse is very helpful while writing the code, but how can I use Eclipse as a frontent for SBT. How can I start an SBT run command from eclipse? How can I start an SBT test command?


Source: (StackOverflow)

How to stop program execution in worksheet?

How can program execution be stopped in the Scala worksheet ?

If code is executing and does not return (an infinite loop) it does not seem possible to stop the program execution without re-starting Eclipse ?


Source: (StackOverflow)

Breakpoints from Scala Worksheet?

I'd like to perform source-level debugging when executing a Scala worksheet.

Since worksheets are evaluated automatically when saved, I can't use the "debug as" menu option like I would a normal project or file.

Is there a way to configure worksheets to run in debug mode so I can step through my code?


Source: (StackOverflow)

How to attach sources to SBT managed dependencies in Scala IDE?

I'm using Scala IDE 2.0.1 and SBT 0.11.2 to start with Akka 2.0.1. My build.sbt looks like this:

name := "akka"

version := "0.1"

scalaVersion := "2.9.2"

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0.1"

As you can see, there's nothing spectacular.

Now how can I tell Eclipse to use the artifact with the sources classifier for the akka-actor library?

In SBT, I can use update-classifiers to download sources and Javadocs to the Ivy repository, but even if I do this before running the eclipse command from the sbteclipse plugin then Eclipse still does not know the sources. Of course, I could do this manually, but this doesn't scale well for more libraries.

I have also tried to use the IvyDE plugin with the deliver-local command. While this integrates the dependency management, it doesn't seem to help with the sources.

Any clues?

Edit: This is the ivy.xml generated from deliver-local:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="default" module="akka_2.9.2" revision="0.1" status="release" publication="20120506225613">
    <description>
    akka
    </description>
</info>
<configurations>
    <conf name="compile" visibility="public" description=""/>
    <conf name="runtime" visibility="public" description="" extends="compile"/>
    <conf name="test" visibility="public" description="" extends="runtime"/>
    <conf name="provided" visibility="public" description=""/>
    <conf name="optional" visibility="public" description=""/>
    <conf name="sources" visibility="public" description=""/>
    <conf name="docs" visibility="public" description=""/>
    <conf name="pom" visibility="public" description=""/>
</configurations>
<publications>
    <artifact name="akka_2.9.2" type="pom" ext="pom" conf="pom"/>
    <artifact name="akka_2.9.2" type="jar" ext="jar" conf="compile"/>
    <artifact name="akka_2.9.2" type="src" ext="jar" conf="sources" e:classifier="sources"/>
    <artifact name="akka_2.9.2" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
</publications>
<dependencies>
    <dependency org="org.scala-lang" name="scala-library" rev="2.9.2" conf="compile->default(compile)"/>
    <dependency org="com.typesafe.akka" name="akka-actor" rev="2.0.1" conf="compile->default(compile)"/>
    <exclude org="org.scala-lang" module="scala-library" artifact="*" type="jar" ext="*" matcher="exact"/>
    <exclude org="org.scala-lang" module="scala-compiler" artifact="*" type="jar" ext="*" matcher="exact"/>
    <override org="org.scala-lang" module="scala-library" matcher="exact" rev="2.9.2"/>
    <override org="org.scala-lang" module="scala-compiler" matcher="exact" rev="2.9.2"/>
</dependencies>
</ivy-module>

I'm new to Ivy, so this doesn't tell me much. I just figure that it mentions sources and javadocs, but somehow the IvyDE doesn't pick it up.


Source: (StackOverflow)

What is the current state of the Scala Eclipse plugin? [closed]

Is the current Scala Eclipse plugin (http://www.scala-lang.org/node/94) usable? I keep reading that its unstable and buggy, even unusable.

See previous thread: http://stackoverflow.com/questions/796258/what-is-the-current-state-of-tooling-for-scala

I've tried it out briefly but only for trivial programs, so far it seems fine.

Thanks!

UPDATE: I'm going to dive in and get some stuff done with Scala and Eclipse, I'll try to report back and let you know what I find.

UPDATE: See my answer below about my experiences with Eclipse 3.5.1 and Scala 2.7.7 Final.

  • Alex

Source: (StackOverflow)

Scala project won't compile in Eclipse; "Could not find the main class."

I have installed Eclipse 3.5.2 and today's Scala plugin from /update-current (that's Scala 2.8 final.) I can compile and run Scala projects consisting of a single singleton object that implements main().

But, if a project contains more classes, I receive the "Could not find the main class" error.

I have tried searching for the solution and I discovered:

Eclipse is correctly looking for the Main$ class, not the Main class
* under Debug Configurations, my main class is correctly identified as mypackage.Main
* my plugin is up to date and recommended for my version of Eclipse
* cleaning, restarting etc. doesn't help.

The same project will compile with scalac.

Thanks for any ideas on how to solve this.

EDIT: MatthieuF suggested I should post the code.

This snippet produces an error. It's not the most idiomatic code, but I wrote it that way to test my environment. I tried it as a single file and as separate files. It DOES work with scalac.

import swing._

class HelloFrame extends Frame {
        title = "First program"
        contents = new Label("Hello, world!")
}

object Hello {
  val frame = new HelloFrame    
  def main(args : Array[String]) : Unit = {
        frame.visible = true
   }
}

BUT, if I nest the definition of HelloFrame within Hello, it works. This snippet runs perfectly:

import swing._

object Hello {

    class HelloFrame extends Frame {
        title = "First program"
        contents = new Label("Hello, world!")
    }

    val frame = new HelloFrame

    def main(args : Array[String]) : Unit = {
        frame.visible = true
    }
}

Source: (StackOverflow)

Scala IDE 4.0.0 thinks there's errors in an out-of-the-box Play Framework 2.3.7 program

I've created a Play Framework program via Typesafe Activator (so it follows the template exactly).

I used sbteclipse-plugin version 3.0.0 to create an Eclipse project and imported that into Scala IDE 4.0.0. These are all the latest versions at the time of writing.

The Scala IDE definitely seems to support the Play Framework. It has syntax highlighting for the custom formats, including the routing file and templates. Yet, it doesn't seem to be able to find the views from the controllers. In particular, the call to views.html.index triggers an error: "object index is not a member of package views.html".

enter image description here

I tried enabling refreshing using native hooks or pooling as detailed here, but it had no affect.

I should note that while the code has been compiled in the command line (with activator ~run), it hasn't been compiled in Scala IDE, since I don't know how to (it doesn't seem to be documented anywhere).

What can I do to get rid of these false errors?

EDIT: After running activator clean ~run, I have another error: The project cannot be built until build path errors are resolved. There's no further details on what these build path errors are.


Source: (StackOverflow)

Scala IDE - Play 2 Eclipse Plug-in not highlighting syntax for Scala HTML Templates

I installed the Scala IDE - Play 2 plug-in (from http://download.scala-ide.org/play2/nightly_3.0-M_juno_2.10-M/site/ ) whereas the Route Editor displays proper syntax highlighting, the Template for Scala does not. Also, it also does not allow me to "Enable" the Syntax Highlighting options in Eclipse's Preferences -> Play -> Template - Syntax Coloring.

Therefore, the Scala syntax is not being highlighted inside main.scala.html and index.scala.html

Am also using http://download.scala-ide.org/nightly-scala-ide-juno-210x for Eclipse Juno.

-James

enter image description here

Right mouse click on above image to open in a new browser tab to see image in full resolution.

enter image description here


Source: (StackOverflow)

Scala+Android: Is anybody successfully building and debugging in Eclipse?

So far, the only way I've been able to debug within Eclipse is to use Treeshaker with Scala IDE's buggy 2.8 branch. If I try to build with Scala IDE without Treeshaker, I get ClassNotFound errors per this long thread on scala-on-android.

Ideally I would build with sbt-android and debug within Eclipse, but I've been unable to do so successfully. The closest to debugging an sbt-android project I was able to achieve was to build the sbt-android project with the android:package-debug command, start the executable with the android:start-emulator command, and then connect DDMS to the application's thread.

However, I had breakpoints set that only would have executed after I connected the debugger to the thread, and none of them caused the thread to stop when reached.

Has anyone been able to debug Scala Android code in Eclipse using any other tools besides Treeshaker with Scala IDE based on Scala 2.8?

UPDATE: I'm successfully debugging (not building) in Eclipse after building from the command line with sbt, sbteclipse, and android-plugin.

What I did was to use Eclipse's new Android project menu, connect to existing source, and point it to the ./src/main directory. Then Eclipse recognized the Android settings, and DDMS recognized the task as belonging to the Eclipse Android project.

I also had to reconfigure the Eclipse project's Java build path source folders by removing the src folder from the build path and adding the ./scala folder. Then I had to restart Eclipse to add breakpoints to the Scala file.

Here's some interesting discussion about the difficulties building and debugging Android applications using Eclipse.


Source: (StackOverflow)

How to create Scala project in proper way?

I would like to create project in scala, with proper directory structure, test directory etc. I'm completly new in Java stuff, so please tell me how to do it? Which tools (maven?) should I use? How to place test and configure them to see my project classes? I use eclipse as IDE. Any help - web resources, links I will appreciate :)


Source: (StackOverflow)

Adding and removing dependencies with SBT and Scala IDE

I've been experimenting with SBT and the Scala IDE (Eclipse) and I'm wondering - what's the standard workflow for adding and removing dependencies from your build.sbt file where the project's referenced libraries will be updated in Eclipse?

Are there any current plugins that are required to use sbt with eclipse when adding / removing dependencies?


Source: (StackOverflow)