creating rpm using sbt native packager for scala play app - scala

I'm using sbt native packager (https://github.com/sbt/sbt-native-packager) to create rpm for the scala play application. I followed the instruction to run the command sbt rpm:packageBin. However, it builds the .jar file, is this the rpm build? I thought the rpm build should be .rpm extension?
I did get error but I am still able to see the .jar file
[info] Done packaging.
[error] `rpmVendor in Rpm` is empty. Please provide a valid vendor for the rpm SPEC.
[error] java.lang.RuntimeException: There are issues with the rpm spec data.
[error] at scala.sys.package$.error(package.scala:27)
[error] at com.typesafe.sbt.packager.rpm.RpmSpec.validate(RpmMetadata.scala:154)
[error] at com.typesafe.sbt.packager.rpm.RpmHelper$.stage(RpmHelper.scala:25)
[error] at com.typesafe.sbt.packager.rpm.RpmPlugin$.$anonfun$projectSettings$47(RpmPlugin.scala:158)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:266)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (rpm:stage) There are issues with the rpm spec data.

Play Framework requires some additional settings for rpm. This is documented here in the Play Documentation.
For simplicity I copy the relevant part here:
Minimal RPM settings
Add the following settings to your build:
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
maintainer in Linux := "First Lastname <first.last#example.com>"
packageSummary in Linux := "My custom package summary"
packageDescription := "My longer package description"
rpmRelease := "1"
rpmVendor := "example.com"
rpmUrl := Some("http://github.com/example/server")
rpmLicense := Some("Apache v2")
Then build your package with:
[my-first-app] $ rpm:packageBin
Finally you should have projectname-projectversion.rpm eventually under target/rpm/RPMS/noarch/ -folder (or something similar).

After your comments I would say you need to add more information in your build.sbt file.
Your project should include data about the rpm. There are lots settings here you can use, but the bare minimum is to add rpmVendor to your build.sbt like this:
rpmVendor := "VendorName"
If you need examples, take a look at some on Github.

Related

Sbt compile throw NumberFormatException for input "vars"

Edit : I know now that I need to access Google Oauth2 authentication with some sort of sbt configuration but I can't find how on official documention...
We recently added a Google Authentication and it seems that instead of loading the sha1, it loads the google auth HTML page.
Anyone knows how to add Google SSO credentials to sbt credentials ? I already have Nexus credentials defined and it was working fine before Google SSO was added
Initial Question :
I launched a new Scala project with sbt.version = 1.4.9 and scalaVersion := "2.12.14" and got the following error.
I tried :
Reinstalling Scala, Sbt, Java.
Changing their version (sbt 1.3.X, 1.4.X / Scala 2.11.X, 2.12.X / Java 8 and 11 openjdk)
Removing everything except the simplest build.sbt (name and scala version),
Removing coursier cache and ivy cache,
Rebooting my computer (MacOS)
Nothing worked...
sbt:quality-orc-delta> compile
[info] Updating
[info] Resolved dependencies
[error] stack trace is suppressed; run last update for the full output
[error] (update) java.lang.NumberFormatException: For input string: "vars"
[error] Total time: 1 s, completed 19 May 2022, 06:54:38
sbt:quality-orc-delta> last update
[debug] not up to date. inChanged = true, force = false
[debug] Updating ...
[info] Updating
[info] Resolved dependencies
[error] java.lang.NumberFormatException: For input string: "vars"
[error] at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
[error] at java.base/java.lang.Integer.parseInt(Integer.java:652)
[error] at java.base/java.math.BigInteger.<init>(BigInteger.java:534)
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$$anonfun$findChecksum$1.applyOrElse(CacheChecksum.scala:22)
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$$anonfun$findChecksum$1.applyOrElse(CacheChecksum.scala:20)
[error] at scala.collection.TraversableOnce.collectFirst(TraversableOnce.scala:172)
[error] at scala.collection.TraversableOnce.collectFirst$(TraversableOnce.scala:159)
[error] at scala.collection.AbstractTraversable.collectFirst(Traversable.scala:108)
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$.findChecksum(CacheChecksum.scala:20)
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$.$anonfun$parseChecksumAlternative$2(CacheChecksum.scala:31)
[error] at scala.Option.orElse(Option.scala:447)
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$.parseChecksumAlternative(CacheChecksum.scala:30
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$.$anonfun$parseRawChecksum$1(CacheChecksum.scala:52)
[error] at scala.Option.orElse(Option.scala:447)
[error] at lmcoursier.internal.shaded.coursier.cache.CacheChecksum$.parseRawChecksum(CacheChecksum.scala:52)
[error] at lmcoursier.internal.shaded.coursier.cache.FileCache.$anonfun$validateChecksum$4(FileCache.scala:677)
[error] at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
[error] at scala.util.Success.$anonfun$map$1(Try.scala:255)
[error] at scala.util.Success.map(Try.scala:213)
[error] at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
[error] at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
[error] at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
[error] at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:834)
[error] (update) java.lang.NumberFormatException: For input string: "vars"
Any help is welcome.

Unable to launch Scala REPL using 'sbt console' due to InvalidPath exception

I am working on Windows 10 OS and installed sbt 1.4.5 from the .msi installer from scala-lang downloads page. Now when I type sbt or sbt about in the command prompt, it works fine but as soon as I type sbt console, I get the following error message:
C:\Users\anka2\Scala_Samples\Variables>sbt console
[warn] Neither build.sbt nor a 'project' directory in the current directory: "C:\Users\anka2\Scala_Samples\Variables"
c) continue
q) quit
?c
[warn] No sbt.version set in project/build.properties, base directory: C:\Users\anka2\Scala_Samples\Variables
[info] welcome to sbt 1.4.5 (Oracle Corporation Java 1.8.0_271)
[info] loading global plugins from C:\Users\anka2\.sbt\1.0\plugins
[info] set current project to variables (in build file:/C:/Users/anka2/Scala_Samples/Variables/)
[error] java.nio.file.InvalidPathException: Illegal char <"> at index 0: "C:\Windows\System32
[error] at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
[error] at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
[error] at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
[error] at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
[error] at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
[error] at java.io.File.toPath(File.java:2234)
[error] at sbt.internal.inc.classpath.ClasspathUtil$.$anonfun$javaLibraryPaths$1(ClasspathUtilities.scala:62)
[error] at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:285)
[error] at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
[error] at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
[error] at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
[error] at scala.collection.TraversableLike.map(TraversableLike.scala:285)
[error] at scala.collection.TraversableLike.map$(TraversableLike.scala:278)
[error] at scala.collection.AbstractTraversable.map(Traversable.scala:108)
[error] at sbt.internal.inc.classpath.ClasspathUtil$.javaLibraryPaths(ClasspathUtilities.scala:62)
[error] at sbt.internal.inc.classpath.ClasspathUtil$$anon$2.<init>(ClasspathUtilities.scala:50)
[error] at sbt.internal.inc.classpath.ClasspathUtil$.toLoader(ClasspathUtilities.scala:48)
[error] at sbt.internal.inc.classpath.ClasspathUtil$.makeLoader(ClasspathUtilities.scala:115)
[error] at sbt.internal.inc.classpath.ClasspathUtil$.makeLoader(ClasspathUtilities.scala:103)
[error] at sbt.Defaults$.$anonfun$consoleTask$1(Defaults.scala:2043)
[error] at sbt.Defaults$.$anonfun$consoleTask$1$adapted(Defaults.scala:2037)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (Compile / console) java.nio.file.InvalidPathException: Illegal char <"> at index 0: "C:\Windows\System32
[error] Total time: 0 s, completed Jan 17, 2021 11:25:34 AM
I tried identifying the error in format by running sbt --verbose and this is what I'm getting:-
C:\Users\anka2>sbt --verbose
# Executing command line:
"C:\Program Files\Java\jdk1.8.0_271\bin\java.exe"
-Dfile.encoding=UTF-8
-Xms1024m
-Xmx1024m
-Xss4M
-XX:ReservedCodeCacheSize=128m
-cp
"C:\Program Files (x86)\sbt\\bin\sbt-launch.jar"
xsbt.boot.Boot
[info] welcome to sbt 1.4.5 (Oracle Corporation Java 1.8.0_271)
[info] loading global plugins from C:\Users\anka2\.sbt\1.0\plugins
[info] loading project definition from C:\Users\anka2\project
[info] set current project to anka2 (in build file:/C:/Users/anka2/)
[info] sbt server started at local:sbt-server-ff142d10856e0dc0f951
[info] started sbt server
But after this, as soon as I type console, I get the same InvalidPath exception message.
It might be elementary but I am absolutely unable to grasp where I am going wrong or how to fix this.
It fails because you are running this command from folder that is not an sbt project. As you can see in your error:
Neither build.sbt nor a 'project' directory in the current directory: "C:\Users\anka2\Scala_Samples\Variables"
Please add to the directory when you want to run it:
project\build.properties file with the content:
sbt.version = 1.4.5
build.sbt file with the content:
name := "test213"
version := "0.1"
scalaVersion := "2.13.4"
Then try to rerun this command.
The problem is SBT is missing couple of files.
Fix: Using cmd
cd to an empty folder.
C:\Users\USER\scala_sample_learning> sbt new scala/hello-world.g8
upon successful implementation of step 2 cmd will prompt you for a name give hello-world
Now you can use sbt console

How do I add an SBT plugin resolver on CircleCI?

I am trying to automate CI/CD of a small Scala project using CircleCI. The project is built using sbt, and tested using the ScalaTest library.
As per the ScalaTest installation instruction's recommendation, I am using the SuperSafe compiler plugin, which required me to add a resolver to global file ~/.sbt/1.0/global.sbt:
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
I can successfully compile and test my project locally. however on CircleCI the build fails with error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.artima.supersafe#supersafe_2.12.8;1.1.7: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.artima.supersafe:supersafe_2.12.8:1.1.7 (Defaults.scala#L3331)
[warn] +- filesystem:filesystem_2.12:0.1
[error] sbt.librarymanagement.ResolveException: unresolved dependency: com.artima.supersafe#supersafe_2.12.8;1.1.7: not found
[error] at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:332)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:208)
[error] at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)
[error] at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:199)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:196)
[error] at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:238)
[error] at sbt.internal.librarymanagement.IvyActions$.updateEither(IvyActions.scala:193)
[error] at sbt.librarymanagement.ivy.IvyDependencyResolution.update(IvyDependencyResolution.scala:20)
[error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:56)
[error] at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:45)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:93)
[error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:68)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$19(LibraryManagement.scala:106)
[error] at scala.util.control.Exception$Catch.apply(Exception.scala:224)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:106)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:89)
[error] at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:149)
[error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:120)
[error] at sbt.Classpaths$.$anonfun$updateTask$5(Defaults.scala:2561)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: com.artima.supersafe#supersafe_2.12.8;1.1.7: not found
This error is to be expected when the required resolver hasn't been added in SBT -- see e.g. this issue. I am new to CircleCI and don't know where its SBT globals dir would be located, or how to modify the file.
Instead I've tried to add the resolver to my project's ./project/plugins.sbt file directly, but this has not fixed the issue.
The SBT and CircleCI config files look as follows:
./build.sbt
name := "my-project-name"
version := "0.1"
scalaVersion := "2.12.8"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.8"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % "test"
./project/build.properties
sbt.version = 1.2.8
./project/plugins.sbt
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.7")
./.circleci/config.yml
(the default Scala config provided by CircleCI)
# Scala CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/sample-config/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.sbt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: cat /dev/null | sbt test:compile
- save_cache:
paths:
- ~/.m2
key: v1-dependencies--{{ checksum "build.sbt" }}
# run tests!
- run: cat /dev/null | sbt test:test
I want a successful CircleCI build, which will require a way to add the resolver, either in the project's own files or declaring it in the SBT globals file of the CircleCI container.
Consider open issue SBT isn't using resolvers defined in project/plugins.sbt #4103. Try scoping the resolver to ThisBuild and put it in both build.sbt and plugins.sbt like so:
// someApp/build.sbt
resolvers in ThisBuild += "Artima Maven Repository" at "http://repo.artima.com/releases"
and
// someApp/project/plugins.sbt
resolvers in ThisBuild += "Artima Maven Repository" at "http://repo.artima.com/releases"
addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.7")
This seems to have worked on this example repo

scala project does not work in intellij

I am getting the following error log when setting up a scala project in intellij:
Error:Error while importing SBT project:<br/>...<br/><pre>[error] at
sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107)
[error] at sbt.io.Using.apply(Using.scala:22)
[error] at sbt.MainLoop$.runWithNewLog(MainLoop.scala:101)
[error] at sbt.MainLoop$.runAndClearLast(MainLoop.scala:57)
[error] at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42)
[error] at sbt.MainLoop$.runLogged(MainLoop.scala:34)
[error] at sbt.StandardMain$.runManaged(Main.scala:113)
[error] at sbt.xMain.run(Main.scala:76)
[error] at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error] at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error] at xsbt.boot.Launch$.run(Launch.scala:109)
[error] at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error] at xsbt.boot.Launch$.launch(Launch.scala:117)
[error] at xsbt.boot.Launch$.apply(Launch.scala:18)
[error] at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error] at xsbt.boot.Boot$.main(Boot.scala:17)
[error] at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.ClassNotFoundException: org.jetbrains.sbt.CreateTasks$
[error] Use 'last' for the full log.
[info] shutting down server</pre><br/>See complete log in file:/home/xxxx/.IdeaIC2017.2/system/log/sbt.last.log
My build.sbt looks as follows:
name := "someProjectName"
version := "0.1"
scalaVersion := "2.12.4"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
Please also note that my "old" projects still work, i.e. this issue occurcs only when doing a new project. Further, I noticed that when I click on SBT projects on the very right, it opens an empty window "SBT projects", for my other projects that window is non-empty.
Any idea what I am doing wrong here?
Many thanks
c
In case you don't want the hassle of upgrading Intellij, you can downgrade the sbt version in sbt.properties file from 1.1.0 (the project default) to, for instance, 1.0.3.
I have been experiencing this problem myself, and solved it by upgrading to intellij version: 2017.3.2 build #IU-173.4127.27.
I think this may have to do with sbt 1.X series no longer being available on the typesafe bintray repository, as I was also having a problem performing some Docker builds.
I had the same problem, so I could not create any Scala class in my project. Found a workaround, by creating a scala module in my project:
Select your project folder, go to File menu, File->New->Module.
In module select Scala and setup your Scala SDK there.
Then you can create scala classes in this module.
downgrade the sbt version in sbt.properties and remove target folder from project and project/project

How to install sbt-sh plugin

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.