Home > Enterprise >  Error on sbt clean assembly when doing sbt clean assembly
Error on sbt clean assembly when doing sbt clean assembly

Time:10-20

In sbt shell I'm getting

sbt clean assembly
[error] Expected ';'
[error] sbt clean assembly
[error]                   ^

what ^ is standing for? How to define the place of the expected ;?

Our build.sbt

import Settings.{assemblySettings, baseImageDockerSettings, commonSettings, finalDockerSettings, environmentArtifactSettings}
import com.typesafe.sbt.SbtGit.GitKeys.gitCurrentBranch
import sbt.{Def, project}
import complete.DefaultParsers._
import sbt.complete._
import sbtrelease.ReleaseStateTransformations.{inquireVersions, setReleaseVersion}
import sbtrelease.{Version, versionFormatError}

version := sparkAppsIndustryVersionSetting.value

lazy val sparkAppsIndustryVersionSetting = Def.setting{
    s"${if (releaseUseGlobalVersion.value) (version in ThisBuild).value else version.value}"
}

releaseVersion := {
    ver => Version(ver).map(_.bump(releaseVersionBump.value).withoutQualifier.string).getOrElse(versionFormatError(ver))
}

releaseProcess := Seq[ReleaseStep](
    inquireVersions,
    setReleaseVersion
)

val minor: Parser[String] = " minor"
val major : Parser[String] = " major"
val combinedParser: Parser[String] = minor | major

//sbt 'bumpVersion minor'
val bumpVersion = inputKey[Unit]("Bumps a version of the bigdata project.")
bumpVersion := {
    val bumpMode = combinedParser.parsed.trim match {
        case "minor" => sbtrelease.Version.Bump.Minor
        case "major" => sbtrelease.Version.Bump.Major
    }
    require(gitCurrentBranch.value.contains("stage") || gitCurrentBranch.value.contains("master"),
        "A version can bumped in the 'master' or 'stage' branches only.")
    val extracted = Project.extract(state.value)
    val newState = extracted.appendWithSession(Seq(releaseVersionBump := bumpMode), state.value)
    Command.process("release with-defaults", newState)
}

//Prints current bigdata project version (sbt printVersion | tail -n 2 | head -1)
lazy val printVersion = taskKey[Unit]("Prints current project version.")
printVersion := println(sparkAppsIndustryVersionSetting.value)


lazy val industry = (project in file("."))
  .enablePlugins(sbtdocker.DockerPlugin)
  .enablePlugins(AshScriptPlugin)
  //  .enablePlugins(HelmPlugin)
  .settings(
    name := "industry",
    commonSettings,
    assemblySettings,
    environmentArtifactSettings,
    libraryDependencies   = Seq(
      "companyname" %% "deps" % "0.1",
      "companyname" %% "core" % "0.1"
    ),
    baseImageDockerSettings,
    finalDockerSettings("core", "0.1"),
    Compile / mainClass := Some("io.companyname.industry.batch.DailySummariesJob"),
    addArtifact(Compile / assembly / artifact, assembly)
  )

our plugins.sbt

// Deploy fat JARs. Restart processes: https://github.com/sbt/sbt-assembly
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")

// sbt plugin for dockerization: https://github.com/sbt/sbt-native-packager
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.24")

// sbt plugin to build Docker Images: https://github.com/marcuslonnberg/sbt-docker
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.2")

// sbt plugin for release management
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")

// sbt plugin for git routines
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")

// sbt plugin for publishing jars to gitlab
addSbtPlugin("com.gilcloud" % "sbt-gitlab" % "0.0.6")

If I do just clean assembly in sbt shell according to Jarrod Baker's advice, I got the comand to be executed well, but I'm still getting the error at the end:

[info] Loading global plugins from C:\Users\eljah32\.sbt\1.0\plugins
[info] Loading settings for project industry-dev-build from plugins.sbt,idea8.sbt ...
[info] Loading project definition from D:\Java\companyname\industry-dev\project
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Compiling 5 Scala sources to D:\Java\companyname\industry-dev\project\target\scala-2.12\sbt-1.0\classes ...
[info] Done compiling.
[info] Loading settings for project industry from build.sbt ...
[info] Set current project to industry (in build file:/D:/Java/companyname/industry-dev/)
[info] Defining Global / ideaPort
[info] The new value will be used by Compile / compile, Test / compile
[info] Reapplying settings...
[info] Set current project to industry (in build file:/D:/Java/companyname/industry-dev/)
[IJ]sbt:industry> clean assembly
[error] Expected ';'
[error] clean assembly
[error]               ^
[IJ]sbt:industry>

CodePudding user response:

When you're using the SBT shell you don't type sbt before your commands. If you're on the command line use sbt clean assembly, from within the shell clean assembly is sufficient.

  • Related