I tried to create a hello world following instructions given in the sbt-documentation.
$ sbt new sbt/scala-seed.g8
WARN: No sbt.version set in project/build.properties, base directory: /Users/pankaj/Work/Code/learn
[warn] Executing in batch mode.
[warn] For better performance, hit [ENTER] to switch to interactive mode, or
[warn] consider launching sbt without any commands, or explicitly passing 'shell'
[info] Set current project to learn (in build file:/Users/pankaj/Work/Code/learn/)
Minimum Scala build.
name [My Something Project]: hello
Template applied in ./hello
$
Now I go into the "hello" directory just created and run "sbt".
$ sbt
[info] Loading project definition from /Users/pankaj/Work/Code/learn/hello/project
[info] Updating {file:/Users/pankaj/Work/Code/learn/hello/project/}hello-build...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-2cf13e211b2cb31f0d3b317289dca70[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/pankaj/Work/Code/learn/hello/project/target/scala-2.10/sbt-0.13/classes...
java.util.UnknownFormatConversionException: Conversion = '0'
at java.util.Formatter.checkText(Formatter.java:2579)
at java.util.Formatter.parse(Formatter.java:2565)
at java.util.Formatter.format(Formatter.java:2501)
…
…
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[error] (compile:compile) java.util.UnknownFormatConversionException: Conversion = '0'
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
$
First, I am clueless why the build tool is using scala-2.10, when the generated build.sbt file has "scalaVersion" 2.12.1 specified under "inThisBuild" settings.
Second, and the main issue is, how to debug and fix the
UnknownFormatConversionException: Conversion = '0'
Not sure how to get past the "Hello, World!" example.
Related
In my multi-project build, I can list all dependencies of one of my subproject:
$ sbt
[info] ...
sbt:MyProject> show subproject2/dependencyClasspathAsJars
/path/jar1:/path/jar2:...:/home/.../MyProject/build/subproject1.jar
sbt:MyProject>
However, I'd need to run this in CI, but...:
$ sbt show subproject2/dependencyClasspathAsJars
[info] Loading global plugins from /home/.../plugins
[info] Loading project definition from /home/.../MyProject/project
[info] Loading settings for project MyProject from build.sbt,modules.sbt ...
[info] Set current project to MyProject (in build file:/home/.../MyProject/)
[error] Not a valid command: show (similar: shell)
[error] Expected whitespace character
[error] Not a valid project ID: show
[error] Expected ':'
[error] Not a valid key: show (similar: showTiming, sLog, ps)
[error] show
[error] ^
To get this classpath from (shell) command line, what should I do? I'm using sbt 1.2.8 & scala 2.10.
show dependencyClasspathAsJars needs to be passed to sbt as a single argument. With common shells, this works:
$ sbt "project subproject2" "show dependencyClasspathAsJars"
project subproject2 selects your subproject and show dependencyClasspathAsJars computes the task on the subproject.
I have been trying to use ensime with sublime to use Scala. To install ensime I created a plugin.sbt in this location
~/.sbt/1.0/plugins/plugins.sbt
here is the screen shot
I also added "addSbtPlugin("org.ensime" % "sbt-ensime" % "2.0.1")" in the plugin.sbt. But when I run sbt and run the command "ensimeConfig" to create .ensime file I get error
C:\Users\Mahadi>sbt
"C:\Users\Mahadi\.sbt\preloaded\org.scala-sbt\sbt\"1.0.1"\jars\sbt.jar"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup
port was removed in 8.0
[info] Loading global plugins from C:\Users\Mahadi\.sbt\1.0\plugins\project
[info] Loading settings from plugins.sbt ...
[info] Loading global plugins from C:\Users\Mahadi\.sbt\1.0\plugins
[info] Loading project definition from C:\Users\Mahadi\project
[info] Set current project to mahadi (in build file:/C:/Users/Mahadi/)
[info] sbt server started at 127.0.0.1:5547
sbt:mahadi> ensimeConfig
[error] Not a valid command: ensimeConfig
[error] Not a valid project ID: ensimeConfig
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: ensimeConfig
[error] ensimeConfig
[error] ^
sbt:mahadi>
So I am looking for your help.
Youn should run sbt in the root directory of your sbt project, as the ensime configuration file is built based on it.
I downloaded play framework from here:
https://www.playframework.com/download
And I chose the Offline Distribution download.
I set the path environment variable and added this:
C:\Framework\activator-dist-1.3.10\bin
While trying to create a new project I wrote in the cmd "activator new" and it worked.
Than I wrote activator eclipse but I got this errors:
C:\Users\***\Desktop\***\FirstPlayProject>activator eclipse
ACTIVATOR_HOME=C:\Framework\activator-dist-1.3.10
The system cannot find the file BIN_DIRECTORY\..\conf\sbtconfig.txt.
[info] Loading project definition from C:\Users\***\Desktop\·δ≡σ·\FirstPlayPro
ject\project
[info] Updating {file:/C:/Users/***/Desktop/%D7%AA%D7%9B%D7%A0%D7%95%D7%AA/Fir
stPlayProject/project/}firstplayproject-build...
[info] Resolving com.typesafe.akka#akka-persistence-experimental_2.10;2.3.11 ...
[info] Resolving com.fasterxml.jackson.datatype#jackson-datatype-jsr310;2.5.4 ..
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to FirstPlayProject (in build file:/C:/Users/***/De
sktop/%D7%AA%D7%9B%D7%A0%D7%95%D7%AA/FirstPlayProject/)
[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error]
Maybe it because of this error: The system cannot find the file BIN_DIRECTORY\..\conf\sbtconfig.txt.
You will need to add sbteclipse for that to work. In your project/plugins.sbt file, add the following:
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
Then compile your app first (compile in the activator shell). Then you can use the eclipse command in the activator shell.
More info: https://www.playframework.com/documentation/2.5.x/IDE#Eclipse
I'm trying to follow this tutorial about scalatra deployment.
But I get error on > container:start, I very new to scala and have no idea what to do, googling result tells me to setup xsbt-web-plugin, but is it right? isn't examples need to fully independent for such custom dependencies or it is scala way?
upd(console output):
➜ scalatra-heroku git:(master) sbt
[info] Loading project definition from /Users/user1/folder1/scalatra-website-examples/2.4/deployment/scalatra-heroku/project
[info] Compiling 1 Scala source to /Users/user1/folder1/scalatra-website-examples/2.4/deployment/scalatra-heroku/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 1 deprecation warning(s); re-run with -deprecation for details
[warn] one warning found
[info] Set current project to Heroku Example (in build file:/Users/user1/folder1/scalatra-website-examples/2.4/deployment/scalatra-heroku/)
> container:start
[error] Not a valid key: start (similar: state, startYear, target)
[error] container:start
[error]
It looks like that README is messed up. Try this example instead:
https://github.com/kissaten/scalatra-heroku
And you can always follow this guide:
http://scalatra.org/2.4/guides/deployment/heroku.html
I'm having trouble with installing Apache Spark on Ubuntu 13.04. Im using spark-0.8.1-incubating, and both ./sbt/sbt update and ./sbt/sbt compile work fine. However, when I do a ./sbt/sbt assembly I get the following error:
[info] Set current project to default-289e76 (in build file:/node-insights/server/lib/spark-0.8.1-incubating/sbt/)
[error] Not a valid command: assembly
[error] Not a valid project ID: assembly
[error] Not a valid configuration: assembly
[error] Not a valid key: assembly
[error] assembly
[error]
I googled for stuff related to this but couldn't find anything useful. Any guidance would be much appreciated.
The current project set to default-289e76 message suggests that sbt was called from outside of the Spark sources directory:
$ /tmp ./spark-0.8.1-incubating/sbt/sbt assembly
[info] Loading global plugins from /Users/joshrosen/.dotfiles/.sbt/plugins/project
[info] Loading global plugins from /Users/joshrosen/.dotfiles/.sbt/plugins
[info] Set current project to default-d0f036 (in build file:/private/tmp/)
[error] Not a valid command: assembly
[error] Not a valid project ID: assembly
[error] Not a valid configuration: assembly
[error] Not a valid key: assembly
[error] assembly
[error] ^
Running ./sbt/sbt assembly works fine from the spark-0.8.1-incubating directory (note the log output showing that the current project was set correctly):
$ spark-0.8.1-incubating sbt/sbt assembly
[info] Loading global plugins from /Users/joshrosen/.dotfiles/.sbt/plugins/project
[info] Loading global plugins from /Users/joshrosen/.dotfiles/.sbt/plugins
[info] Loading project definition from /private/tmp/spark-0.8.1-incubating/project/project
[info] Loading project definition from /private/tmp/spark-0.8.1-incubating/project
[info] Set current project to root (in build file:/private/tmp/spark-0.8.1-incubating/)
...
You typed "abt" twice, but shouldn't that be "sbt"? Apache Spark has its own copy of sbt, so make sure you're running Spark's version to pick up the "assembly" plugin among other customizations.
To run the Spark installation of sbt, go to the Spark directory and run ./sbt/sbt assembly .