Can NetBeans 8.0 with Scala and sbt plugins installed create sbt project? - scala

I had previously used Scala-IDE, and I thought I'd give NetBeans IDE 8.0 a try.
I created Java/Maven projects successfully, but I don't seem to be able to create an sbt project. I have all the Scala plugins loaded as far as I can see, including the sbt plugin. Platform is Win 8.1 and Java 8.
Creating an NetBeans native project for Scala works, but there seems to be no option to create an sbt project. Is that expected?

Iff the plugin you use is nbscala-1.6.3.1 it appears from the documentation that the supported features are:
Recognize sbt project and open in NetBeans
Open sbt console in NetBeans (Right click on sbt project, choose "Open Sbt")
Jump to/Open compile error lines
I conclude that there's no support for creating a new sbt project using the plugin.
You'd have to create a sbt project using Typesafe Activator and only then use NetBeans with the plugin to open it and start hacking right in the environment.

Related

Scala build process

First some context:
My aim is to use scala alongside a testing environment, preferably in an ide.
At first I installed scala (v. 2.10.1) and sbt and it worked. I used emacs and a shell.
Then I wanted to use eclipse and installed the sbt plugin. But when I tried the FlatSpec example of the scalatest website together with the scalatest lib, it did compile but 0/0 tests did run.
In intellij I tried the same example but although I gave my sdk location, the collection package wasn't found.
My problem:
I don't understand what I have to tell my ide or what I have to write (maybe files for maven or make etc.) or where I can learn all that.
My question:
What has the ide to know if I want to run a scala project?
- location of sdk, jdk, sbt, my_project, ...
- versions of scala, java etc.
What else must it know?
IntelliJ has build in support for sbt projects. My work flow is the following :
Create a project (in the shell) using sbt. Basically you have to create a build.sbt and the necessary directory structure
`src/main/scala`
`src/main/resources`
`src/test/`
The in IntelliJ just do Open -> select build.sbt.
Also check auto-import checkbox.
Everything should work after this.
NOTE: You may have to install the Scala and sbt plugin for the above to work.

Eclipse Scala IDE: How to build standalone Scala app?

I am writing an app that uses AnormCypher (Cypher-oriented Scala library for Neo4j Server https://github.com/AnormCypher). I write my code in Eclipse Scala IDE. Using sbteclipse plugin I have imported AnormCypher sbt project into Eclipse. Next I have added it to Java build pass as external project. Everything compiles and works from Eclipse now.
Question: How in Eclipse build a standalone Scala program with all necessary dependencies including external Scala project imported in Eclipse?
Trying to create'executable jar' from Eclipse does not work in this case because to do so Eclipse requests "Select a 'Java Application' launch configuration to use to create a runnable JAR." Alas Eclipse here has no idea about Scala launch configuration.
There is not currently a feature of the Scala IDE.
However, it's easy to write a simple build file for your project using sbt. Once there, you can use one of the numerous available plugins to create a distribution for it. Sbt has its own sbt-assembly and sbt-oneJar to create standalone JARs, and there is twitter's sbt-package-dist, with more varied publishing options.

How to add dependencies in Eclipse which sbt and Play 2.0 can see

I am working on a Scala library in Eclipse (proj1).
This library I would like to test in a Play 2.0 Scala web app.
So I have run the eclipse command from the cmd line and imported the project into Eclipse (proj2).
So I have two eclipse projects side by side. I can add the first project (proj1) to the build path of proj2 in Eclipse.
This way I can import the library and write the code.
But when Play compiles it can't see library I've added to the build path.
If I run the eclipse command again the library is removed from the build path.
Is there any way to reference the project? I would prefer not to build a jar and import that via sbt.
I simply add them via sbt and regenerate the eclipse project from the Play console.

How do I set up Play Framework 2.0 in Netbeans with Scala IDE

I downloaded the http://wiki.netbeans.org/Scala "Scala IDE" Netbeans Plugin, and it works great. I then created a new Scala project from existing sources. Also worked great. The only issue is now that Netbeans does not recognize any of the play classes/packages. It seems that the SBT plugin somehow automatically downloads dependencies. How can I download these dependencies manually, and add them to my Netbeans library, or where can I find the downloaded Play JAR's?
I haven't tried this myself but perhaps you can run play eclipsify and then do a File->Import Project->Eclipse Project from Netbeans.

Scala / Lift: Set up hotdeploy through Eclipse?

How do I set up hotdeploy for Scala/Lift projects in Eclipse?
Basically, I would like to be able to
Set up a new project, from say lift-archetype-basic
Launch jetty:run, either from some run-configuration or through terminal
Be able to edit Scala files in Eclipse, Save/Auto compile
Refresh the web-page in the browser and see the updates.
The tutorial at http://wiki.liftweb.net/index.php/Using_eclipse_hotdeploy is out-dated and I really can't figure out how to set this up.
I currently have
Eclipse 3.5
Maven IAM plugin version 0.11
Scala plugin 2.8.0.RC6
Should I use any other versions or plugins?
With SBT it's possible to continuously recompile and reload the web application when using Jetty:
jetty-run
~ prepare-webapp
jetty-run starts Jetty and the ~ prepare-webapp recompiles and recreates the web application whenever sources files change.
SBT is compatIble with Maven and Ivy, so you may generate the project file layout with Maven archetypes, and switch to SBT later - it will recognize repositories and dependencies specified in the POM.
This tutorial video shows, how to get stated with SBT and Eclipse.