Typesafe Activator compilation error - scala

I'm using Typesafe Activator on Ubuntu 13.04. It was working, but when I create a new project sometimes it doesn't do anything and sometimes it reports that the template is cloned (without downloading anything). When the project is created I get the following compile error:
Refreshing list of source files to watch for changes...
Loading project definition from
/home/myusername/activator-play-autosource-reactivemongo/project
Set current project to activator-play-autosource-reactivemongo (in
build file:/home/myusername/activator-play-autosource-reactivemongo/)
Applying State transformations com.typesafe.sbtrc.SetupSbtChild from
"""/home/myusername/.sbt/boot/scala-2.9.2/com.typesafe.sbtrc/sbt-rc-probe-0-12/1.0-28edcfb4984c8be5e556bad192b62551504aa23d/sbt-rc-props-1.0-28edcfb4984c8be5e556bad192b62551504aa23d.jar:/home/myusername/.sbt/boot/scala-2.9.2/com.typesafe.sbtrc/sbt-rc-probe-0-12/1.0-28edcfb4984c8be5e556bad192b62551504aa23d/sbt-rc-probe-0-12-1.0-28edcfb4984c8be5e556bad192b62551504aa23d.jar"""
java.lang.ClassNotFoundException: com.typesafe.sbtrc.SetupSbtChild$
Use 'last' for the full log.
Failed to reload source file list: sbt process never got in touch, so
unable to handle request WatchTransitiveSourcesRequest(true)

In project/build.properties change the sbt.version from 0.12.3 to 0.13.0 (or 0.12.4 alternatively).
I just had the same issue, for me this fixed it.

I just deleted all the activator generated files and it worked fine for me with following
In build.sbt:
scalaVersion := "2.10.4"
In project/plugin.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
Activator version: 1.1.3

Related

IntelliJ 13 with SBT plugin does not recognize Scalding dependency

I am trying to add Scalding 2.10 as a managed dependency via build.sbt like so:
name := "ss"
version := "1.0"
libraryDependencies += "com.twitter" % "scalding_2.10" % "0.10.0"
IntelliJ downloads the jar and adds it as an external library (see screen below) but fails to resolve the com.twitter namespace.
I have tried both invalidating the IntelliJ cache and generating project files via sbt gen-idea but neither solutions have worked. Any ideas would be greatly appreciated.
The scalding jar file scalding_2.10 has no code in it to compile against. Its just 300 Bytes in size.
The correct dependency I feel should be
libraryDependencies += "com.twitter" % "scalding-core_2.10" % "0.11.1"
As the comment suggest try rm-ing your ivy2 cache, and try sbt gen-idea. If that doesn't work, other things to check:
makes sure you have indeed got the scala plugin installed.
Most likely you're java SDK is not set or pointing somewhere wrong; right click the project dir, click "Open Module Settings", go to SDK and make sure the path is correctly set to the jdk otherwise syntax highlighting will likely break.
To test your deps have been properly pulled in from tinternet, try sbt compile; if it compiles then you should indeed have downloaded the dependency properly.

Intellij 13 and importing an SBT project

I just installed Intellij 13 and tried importing some basic SBT project. However I received the following error:
The error message tells that org.jetbrains#sbt-structure;latest.integration cannot be found.
I am using SBT 0.13 and everything (compiling, running and etc..) seems to work from the CLI. I have also followed the installation instructions of the idea-sbt plugin (https://github.com/mpeltonen/sbt-idea).
build.sbt that I am using:
name := "demo"
version := "1.0"
scalaVersion := "2.9.2"
project/plugins.sbt:
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.2")
Did anyone had this issue and managed to resolve it?
Thanks!
This was a known issue and is resolved in the latest version 0.26.327 (try to run 'Check for Updates...').
If the problem persists, it must be due to another issue but not dependency resolution. In that case you can resort to using the sbt-idea plugin. From a terminal inside your project directory execute sbt gen-idea, afterwards you should be able to use 'Open Project...' in IDEA.

How can IntelliJ find remote dependencies?

I added the Mailer plugin to my Play Framework 2 project. It compiles and works fine, but IntelliJ can't resolve any of its classes. I would normally just add the jar as a module in my IntelliJ project settings, but I don't have a jar. As far as I understand, the plugin is automatically being pulled from some repository. So how do I make IntelliJ aware of it?
I added this to conf/play.plugins
1500:com.typesafe.plugin.CommonsMailerPlugin
And this as a dependency in project/build.scala
"com.typesafe" %% "play-plugins-mailer" % "2.0.4"
I resolve problems like this with the sbt-idea SBT plugin. Just add this to your project/plugins.sbt file:
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
Then, whenever you change your project dependencies, run sbt idea and your IntelliJ project will be updated.
I had to delete the reference to com.github.mpeltonen in my plugins.sbt file first. Then as Bill said, I needed to run play idea. If I tried to run play idea without deleting the reference I got this exception:
java.lang.NoSuchMethodError: org.sbtidea.SbtIdeaPlugin$.ideaSettings()Lscala/collection/Seq;

Installing sbteclipse

i have problems top use sbteclipse
What I have done:
went to my global sbt folder.
created a plugins folder
created the file plugins.sbt with addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
went to my eclipse project and created a build.sbt file
it contains:
name := "foo"
version := "1.0"
scalaVersion := "2.9.2"
libraryDependencies += "net.java.dev.jna" % "jna" % "3.4.0"
I am selecting the project folder in my cmd. and type sbt eclipse
But I always get the following error
[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse
[error] Expected ':'
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error] ^
ps: I am using Windows. I am also using sbt 0.12
Your global sbt folder is at %USERPROFILE%\.sbt (C:\Users\<username>\.sbt most likely). So your plugins should be defined at %USERPROFILE%\.sbt\plugins\plugins.sbt
Failing this you can add it to your project directly. Add the file path is <project_root>\project\plugins.sbt. If the project directory doesn't exist you will need to create it.
I think that I might have found a solution. First, the default directory checked for plugins configuration is 'USER_HOME/.sbt/plugins' and NOT 'USER_HOME/.sbt/0.13/plugins'.
Secondly, the sbt version specified seems to matter. In 'PROJECT_HOME/project/build.properties', there's an 'sbt.version' property. If the version of sbt specified in this file is different from the actually installed version of sbt, there's likely to be an issue. I think I was affected more so by this because I'm using an Activator template and it already had 'sbt.version' specified in this 'build.properties' file.
While nosing around, I came across this
"Support for plugin configuration in project/plugins/ has been removed. It was deprecated since 0.11.2" from sbt website at http://www.scala-sbt.org/0.13.0/docs/Community/ChangeSummary_0.13.0.html. I still see a lot of guys pointing that it should be configured in 'PROJECT_HOME/projects/plugins.sbt'. I think this is very confusing.
I had similar a issue and answered to a similar question.
I tried "everything" and, eventually, I just had to update my sbt from 0.13.1 to 0.13.9.

Global sbteclipse plugin not found/loaded

I am having some serious difficulty installing sbteclipse as a global plugin. It seams like the global plugins are not being loaded. I created the .sbt directory and added a plugins directory. In the plugins directory I added the following build.sbt definition:
resolvers += Classpaths.typesafeSnapshots
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-SNAPSHOT")
the above definition is in the ~/.sbt/plugins directory. When I search online I see plenty of sbt startups that look like the following: (notice the global plugin load and the project definition path)
Now here is an example of my sbt startup and my attempt to run eclipse:
Any thoughts on what I am doing wrong. I have been working on this for hours.
EDIT:
The error I get for not running sbt as superuser:
> mkemnetz#ubuntu:~/git/GymWebApp$ sbt
bash: /bin/sbt: Permission denied
mkemnetz#ubuntu:~/git/GymWebApp$
EDIT2:
mkemnetz#ubuntu:~/git/GymWebApp$ sbt
[info] Loading global plugins from /home/mkemnetz/.sbt/plugins
[info] Set current project to default-18287a (in build file:/home/mkemnetz/git/GymWebApp/)
> eclipse
[info] About to create Eclipse project files for your project(s).
[error] java.io.FileNotFoundException: /home/mkemnetz/git/GymWebApp/target/streams/$global/project-descriptors/$global/out (Permission denied)
[error] Use 'last' for the full log.
This is the current error I am getting. Still not working but much improved thanks to darwin
Instead of build.sbt in my ~/.sbt/plugins dir I have plugins.sbt with the content like in your example. And everything works fine for me.
UPD:
The problem occurs because of you run sbt command under superuser's environment so sbt conf is not resolved properly.
Just run sbt under your user after removing project target dir.
This is my ~/.sbt/plugins/build.sbt:
resolvers += Classpaths.typesafeResolver
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
Quoting sbteclipse github
For sbt 0.13 and up Add sbteclipse to your plugin definition file. You
can use either: the global file (for version 0.13 and up) at
~/.sbt/0.13/plugins/plugins.sbt the project-specific file at
PROJECT_DIR/project/plugins.sbt
AND I want to comment on this "backward compatibility is very important!"