Error while importing sbt project:
d; set _root_.org.jetbrains.sbt.StructureKeys.sbtStructureOptions in Global := "download resolveClassifiers" ;*/*:dumpStructureTo /private/var/folders/5v/g3zxt_7d64g3sd_56bzpqbvh0000gn/T/sbt-structure.xml; session clear-all
[error] Expected ID character
[error] Not a valid command: d
[error] Expected 'debug'
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: d
[error] d; set _root_.org.jetbrains.sbt.StructureKeys.sbtStructureOptions in Global := "download resolveClassifiers" ;*/*:dumpStructureTo /private/var/folders/5v/g3zxt_7d64g3sd_56bzpqbvh0000gn/T/sbt-structure.xml; session clear-all
[error] ^
The error appeared after I upgraded the sbt version to sbt.version=0.13.16 in ./project/build.properties. Using sbt from the terminal works just fine.
Update: A workaround I found is to disable importing the project via the sbt shell.
Try deleting the target folder and running the commands again
Related
I have created a project by importing existing sources in Intellij IDEA.
When I run from my comand line,sbt and then console I got this
[info] Compiling 7 Scala sources to
/home/milenko/example/project/target/scala-2.10/classes...
[error] /home/milenko/example/project/CommonBuild.scala:20: not found: type ModuleID
[error] dependencies: Seq[ModuleID] = Seq(),
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:26: not found: type Build
[error] trait CommonBuild extends Build {
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:28: not found: value SettingKey
[error] val course = SettingKey[String]("course")
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:30: not found: value SettingKey
[error] val assignment = SettingKey[String]("assignment")
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:32: not found: value SettingKey
[error] val assignmentsMap = SettingKey[Map[String, Assignment]]("assignmentsMap")
My example folder
milenko#milenko-desktop:~/example$ ls
assignment.sbt build.sbt project src target
Then I have changed directory to project,and run sbt and console in project.
My IDEA import is here
It seems that CommonBuild.scala is not positioned at the wright place.How to change this?
You should run sbt command from the root of your build, not in the project directory. project directory is used to build the build definition of your project, because sbt is recursive.
In other words, in your case you need to run sbt in ~/example directory.
I was wondering if I could get some help with this one. I know there are many different issues with the same title, however, after following all the instructions (I hope), I could not get it to compile still. I've been at this for over 7 hours.
This is my issue. I am using Cygwin64 terminal to do some scala programming with sbt. I run the test and make sure that the test file is in the test folder but nothing is working. I have tried to compile it without the test file and then bring it back in but it does not work either.
$ sbt test
[info] Loading project definition from C:\cygwin64\home\Sam\hof\project
[info] Set current project to hof (in build file:/C:/cygwin64/home/Sam/hof/)
[info] Compiling 1 Scala source to C:\cygwin64\home\Sam\hof\target\scala-2.10\test-classes...
[error] C:\cygwin64\home\Sam\hof\src\test\scala\TestSuite.scala:3: object scalatest is not a member of package org
[error] class TestSuite extends org.scalatest.FunSuite {
[error] ^
[error] C:\cygwin64\home\Sam\hof\src\test\scala\TestSuite.scala:5: not found: value test
[error] test("map2 with add"){
[error] ^
[error] two errors found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 3 s, completed Sep 19, 2016 1:07:10 AM
Is there anything I can do?
I had the same problem. Running sbt test in the project root gave me the object scalatest is not a member of package org error. But when I changed to src/test directory, it completed successfully.
https://github.com/steppenwells/sbt-sh
I'm using sbt 0.13.9 and try to install sbt-sh with given instructions. However sbt does not recognize sh command:
> sh ls
[error] Expected ID character
[error] Not a valid command: sh
[error] Expected 'show'
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: sh
[error] sh ls
[error] ^
>
Instructions are for sbt 0.10, maybe things have changed since those days and this guide is out of date?
The instructions are a bit outdated. Instead of ~/.sbt/plugins/project, you should put the MyPlugins object in ~/.sbt/0.13/plugins/project/MyPlugins.scala.
However, sbt-sh doesn't seem to work, even with that correction:
[error] $HOME/.sbt/0.13/staging/1375c2d4ab8153e18523/sbt-sh/src/main/scala/org/sbtsh/SbtShPlugin.scala:4: object CommandSupport is not a member of package sbt
[error] import sbt.CommandSupport._
[error] ^
[error] one error found
[error] ({git://github.com/steppenwells/sbt-sh.git}sbt-sh/compile:compileIncremental) Compilation failed
Can you try xsbt-sh instead?
Create a file ~/.sbt/0.13/plugins/xsbt-sh.sbt with this content:
resolvers += "Element Releases" at "http://repo.element.hr/nexus/content/repositories/releases/"
addSbtPlugin("hr.element.xsbt" % "xsbt-sh" % "0.0.2")
The Github README refers to 0.1.0 but that doesn't seem to have been yet released to the repository.
Can somebody provide me with an example build.sbt file showing how to use revolver with multiple projects?
Specifically where should the Revolver.settings statement go, at the top level or in one or more of the sub-projects? The top level does not work for me and I cannot add it to a sub-project without the build breaking.
For what it's worth when I add the settings at the project top-level I get the following error
> project backend
> re-start 2551
[error] Expected ID character
[error] Not a valid command: re-start
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Expected '::'
[error] Not a valid key: re-start (similar: state, startYear, cross-target)
[error] re-start 2551
[error] ^
Turns out you need to create a second build.sbt file in the sub-projects directory, and put the settings for it there. An example of this stub build file is below:
Revolver.settings
javaOptions in run ++= Seq("-Djava.library.path=lib")
javaOptions in Revolver.reStart ++= Seq("-Dconfig.resource=dev.conf", "-Djava.library.path=src/universal/lib")
mainClass in Revolver.reStart := Some("com.example.Main")
I would like to accomplish running the equivalent of this
sbt -jvm-debug 5005
However I don't seem to be able to pass in args in Windows. This is what I am seeing
>sbt -jvm-debug 5005
[info] Loading project definition from [myProject]
[info] Set current project to [myProject] (in build file myProject)
[error] Expected letter
[error] Expected symbol
[error] Expected '!'
[error] Expected '+'
[error] Expected '++'
[error] Expected ';'
[error] Expected end of input.
[error] Expected 'show'
[error] Expected '*'
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected key
[error] 5005
[error] ^
[error] Not a valid command: jvm-debug
[error] Not a valid project ID: jvm-debug
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: jvm-debug
[error] jvm-debug
[error] ^
I would like to be able to remote debug this application from Intellij. Any help would be great!
set SBT_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
sbt run
was the only working solution on Windows 7.
Seems like the Windows version of SBT doesn't define this functionality.
On Linux it is defined in the $SBT_HOME/sbt/bin/sbt-launch-lib.bash as
addDebugger () {
addJava "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"
}
You can achieve the same result by setting the SBT_OPTS environmental variable on Windows.
Run SBT like this, to make the debugger listen on port 5005
set SBT_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" && sbt
Currently, I'd downloaded the last updated sbt, exactly sbt 1.3.3 but when I want to enable debug in the project, I had the same problem as you. Investigating, I could see that I haven't this file (sbt-launch-lib.bash) in my own root C:\Program Files (x86)\sbt\bin so when I see in another machine, I could notice that sbt, It was 1.2.8 and yes it had the file that I mentioned before so I uninstalled sbt 1.3.3 and I installed sbt 1.2.8 and put in my project sbt -jvm-debug 9999 and it works.