softshipper
softshipper

Reputation: 34099

Can not import 3rd party libs into sbt console

Every time when I try to import 3rd part libs into sbt console as the following:

scala> import eu.timepit.refined.api.Refined
              ^
       error: not found: value eu

As you can, I have got the error message.

The build.sbt is defined as follows:

import Dependencies._

ThisBuild / scalaVersion := "2.13.3"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "io.databaker"
ThisBuild / organizationName := "databaker"

lazy val tests = (project in file("modules/tests"))
  .configs(IntegrationTest)
  .settings(
    name := "user-svc-test-suite",
    /*   scalacOptions ++= Seq(
      "-deprecation",
      "-encoding", "UTF-8",
      "-language:higherKinds",
      "-language:postfixOps",
      "-feature",
      //"-Xfatal-warnings",
      "-Ymacro-annotations",
      "-language:implicitConversions"
    ),*/
    scalafmtOnCompile := true,
    Defaults.itSettings,
    libraryDependencies ++= Seq(
          CompilerPlugins.better_monadic_for,
          CompilerPlugins.context_applied,
          CompilerPlugins.kind_projector,
          TestLibraries.weaver
        ),
    testFrameworks += new TestFramework("weaver.framework.TestFramework")
  )
  .dependsOn(core)

lazy val core = (project in file("modules/core"))
  .enablePlugins(JettyPlugin)
  .settings(
    name := "user-svc-core",
    scalafmtOnCompile := true,
    mainClass := Some("io.example.Main"),
    containerPort := 9090,
    resolvers += Resolver.sonatypeRepo("snapshots"),
    Defaults.itSettings,
    libraryDependencies ++= Seq(
          CompilerPlugins.better_monadic_for,
          CompilerPlugins.context_applied,
          CompilerPlugins.kind_projector,
          Libraries.cats,
          Libraries.cats_meow_mtl,
          Libraries.cats_effect,
          Libraries.cats_meow_mtl_core,
          Libraries.cats_meow_mtl_effects,
          Libraries.circe_core,
          Libraries.circe_generic,
          Libraries.circe_parser,
          Libraries.circe_refined,
          Libraries.ciris_core,
          Libraries.ciris_enum,
          Libraries.ciris_refined,
          Libraries.http4s_dsl,
          Libraries.http4s_server,
          Libraries.http4s_servlet,
          Libraries.http4s_client,
          Libraries.http4s_circe,
          Libraries.refined_core,
          Libraries.refined_cats,
          Libraries.log4cats,
          Libraries.newtype,
          Libraries.servlet,
          Libraries.doobie_core,
          Libraries.doobie_postgres
        )
  )

Why it is not possible to import 3rd party libs into sbt console?

Upvotes: 0

Views: 144

Answers (1)

Mario Galic
Mario Galic

Reputation: 48430

You likely have to change to the sub-project core before executing console, that is, first execute

sbt

then change project

project core

then

console

The reason is refined is defined as libraryDependency of core project instead of root project. A one-liner would be

sbt "project core" console

Upvotes: 1

Related Questions