SBT Assembly not working (not a valid command)

Viewed 24193

I have tried a lot of solutions that I could find related to this topic. Above all of them,

sbt assembly command not found

looked the most related, but that did not solve it.

I am using sbt 13.7

build.sbt:

lazy val commonSettings = Seq(
  organization := "com.example",
  version := "0.1.0"
)

lazy val app = (project in file(".")).
  settings(commonSettings: _*).
  settings(
    name := "fat-jar-test"
  )

assembly.sbt:

resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")

project structure

root
  |
  src
  target
  project
    |
    build.sbt
    assembly.sbt

In sbt I compile succesfully, I can package succesfully, but when I run assembly command I get:

[error] Not a valid command: assembly
[error] Not a valid project ID: assembly
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: assembly
[error] assembly
[error]

I am using Intellij but running sbt from terminal.
I am on Mac OSX.
I originally downloaded sbt and installed from their site, normal installation. I removed and tried installing from macports, no difference.
I had scala version in build.sbt setting, but removed it because I was getting errors and read the 2.11.x does not work with sbt. That stopped errors, but I still have assembly problem.

EDIT:

I was unsure of placement of build.sbt in this structure. Before I had it in the root directory. At suggest of Roman below, I have moved it back to there, but alas I receive the exact same error.

2 Answers

The same problem occurred for me. i had the correct structure of files and folder.

The mistake i was doing is running the sbt assembly from the myproject/project folder. Try running same command from top project folder. run from C:\Users*\IdeaProjects\untitled9 not from C:\Users*\IdeaProjects\untitled9\project

Related