Play: error: not found: value playScalaSettings - scala

I'm trying to create a new play application, myFirstApp, in Scala using sbt 0.12. I've build.sbt, in myFirstApp/ folder. I've also added plugins.sbt to myFirstApp/project/ folder.
Build.sbt
import play.Project._
name := "My first application"
version := "1.0"
playScalaSettings
plugins.sbt
// Typesafe snapshots
resolvers += "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/"
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0-M1")
build.properties
sbt.version=0.12.3
On executing sbt from myFirstApp folder, I get this error:
error: not found: value playScalaSettings
How do I get rid of it?

Just change
build.properties
sbt.version=0.13.0
and
plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.3")
As of May 9th, 2014, last stable version for the plugin is 2.2.3. You can check Typesafe repo for current releases.
There is currently no SBT 0.12.x plugin for Play 2.2: http://repo.typesafe.com/typesafe/releases/com.typesafe.play/sbt-plugin/scala_2.10/
and I M1 is also not in the repo http://repo.typesafe.com/typesafe/releases/com.typesafe.play/sbt-plugin/scala_2.10/sbt_0.13/

Related

Scala SBT elasticsearch-hadoop unresolved dependency

When adding dependency libraryDependencies += "org.elasticsearch" % "elasticsearch-hadoop" % "5.1.1" and refreshing project, I get many unresolved dependencies(cascading, org.pentaho,...).
However if I add another dependency, like libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.1.0" it works and I can use the library in my scala files.
So, is the problem coming from elasticsearch-hadoop ? I'm using SBT 0.13.13 but also tried with 0.13.8.
I took the dependency from https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch-hadoop/5.1.1 I know that for some dependencies you need to add the repository aswell (resolvers += ...), but here it doesn't seems to need a repo.
Add the following in your build.sbt file:
resolvers += "conjars.org" at "http://conjars.org/repo"
Can update your .sbt file
name:="HelloSparkApp"
version:="1.0"
scalaVersion:="2.10.4"
libraryDependencies+="org.apache.spark"%%"spark-core"%"1.5.2"
And execute the below commands from the project directory
sbt clean
sbt package
sbt eclipse

how to configure mahout with play framework

How can I include mahout 0.9 libraries in play-framework 2.2.
I have added the jar files in the build path of eclipse but when I run the play app the following error is displayed for mahout imports
error: package org.apache.mahout.cf.taste.model does not exist
Include this line in build.sbt of play project
"org.apache.mahout" % "mahout-core" % "0.9"
Full build.sbt looks like this
name := <your_project_name>
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
"org.apache.mahout" % "mahout-core" % "0.9"
)
play.Project.playJavaSettings

the plugin.sbt can not add more than one plugins.

I use sbt with playframework and activator to build a webapp.
my sbt version is 0.13.0
I change the plugin.sbt file to:
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
and then the error is:
F:\mysource\play-slick>sbt
F:\mysource\play-slick\project\plugins.sbt:9: error: eof expected but ';' found.
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
^
[error] Error parsing expression. Ensure that settings are separated by blank lines.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
I want to know how to add more than one SbtPlugin in plugins.sbt?
In .sbt files, you must have a blank line between settings (note the error message, Ensure that settings are separated by blank lines.). So, it should be:
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
For more details on .sbt files, see http://www.scala-sbt.org/0.13.1/docs/Getting-Started/Basic-Def.html.

How to set up Scala X-Ray plugin?

I want to use the Scala X-Ray plugin.
I compiled the plugin and dropped the jar file - sxr-0.3.1-SNAPSHOT.jar - in ~/.sbt/0.13/plugins and wrote Scalatron's plugin.sbt (as project/plugin.sbt) to configure the plugin as follows:
addCompilerPlugin("org.scala-tools.sxr" % "sxr" % "0.3.0-SNAPSHOT" cross CrossVersion.full)
scalacOptions <+= scalaSource in Compile map { "-P:sxr:base-directory:" + _.getAbsolutePath }
Then, I tried to sbt dist the project that failed at compilation:
sbt dist
But compilation was failed:
.../scalatron-master/project/plugins.sbt:10: error: not found: value CrossVersion
addCompilerPlugin("org.scala-tools.sxr" % "sxr" % "0.3.0-SNAPSHOT" cross CrossVersion.full)
^
[error] Type error in expression
Can anyone help me with the plugin's configuration?
There are two issues with the documentation on the sxr project's page and in Compiler Plugin Support.
First, the compiler plugin's in the Typesafe Releases repository so you need to add a proper resolver.
Second, the compiler plugin's changed the package that's now org.scala-sbt.sxr.
That said, the build.sbt of your project should be as follows:
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
addCompilerPlugin("org.scala-sbt.sxr" %% "sxr" % "0.3.0")
scalacOptions <+= scalaSource in Compile map { "-P:sxr:base-directory:" + _.getAbsolutePath }
p.s. I submitted a pull request to update README.md in the browse's github repository.
I think you're suppose to put
addCompilerPlugin("org.scala-tools.sxr" % "sxr" % "0.3.0-SNAPSHOT" cross CrossVersion.full)
scalacOptions <+= scalaSource in Compile map { "-P:sxr:base-directory:" + _.getAbsolutePath }
in your build.sbt, not project/plugins.sbt.

How does one get sbt-idea to work in scala-2.10 project?

I had a lot of trouble getting sbt-idea to work in my Scala 2.10 project.
I tried compiling sbt-idea from its git repo, making sure that to have set
scalaVersion := "2.10.0-RC5"
in build/Build.scala, and using publish-local command to compile it in git. But I nevertheless keep getting
[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.
when I then use that in my published version, say by simply adding
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0-SNAPSHOT")
to the project/plugins.sbt file.
Don't think you need to build SBT for Scala 2.10. I keep my gen-idea and eclipse project generators in the global build.sbt file and it works for all my projects (or so it seems ;-)
I'm using Ubuntu, so where the SBT config files are saved on your computer may be different.
Create a folder called plugins under the hidden sbt directory. On Linux this is located at ~/.sbt (where tilde is an alias for your home directory). So now you should have ~/.sbt/plugins
Then create a file called build.sbt under this directory and add the following to it:
resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
resolvers += "Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases/"
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0-SNAPSHOT")
To test, I just generated a scala 2.10 project with it, and it seems fine.
Oh, the file above also adds support for the eclipse command in SBT if you want to generate Scala-IDE projects.
I was able to use an older version of gen-idea by adding the following to project/plugins.sbt in the project itself:
import sbt._
import Defaults._
libraryDependencies += sbtPluginExtra(
m = "com.github.mpeltonen" % "sbt-idea" % "1.2.0", // Plugin module name and version
sbtV = "0.12", // SBT version
scalaV = "2.9.2" // Scala version compiled the plugin
)