scala - Can't resolve jar library in InteliJ when adding to libraries in SBT project -
i want add together apache commons library scala project. before moving sbt worked adding library or global library setting within intelij project. moved sbt doesn't resolve anymore , i'm getting errors.
how add together local jar library sbt dependency within intelij?
you need create sure sbt able find dependency. follow standard way of adding unmanaged dependencies project described here. citing reference:
unmanaged dependencies
most people utilize managed dependencies instead of unmanaged. unmanaged can simpler when starting out.
unmanaged dependencies work this: add jars lib , placed on project classpath. not much else it!
you can place test jars such scalacheck, specs, , scalatest in lib well.
dependencies in lib go on classpaths (for compile, test, run, , console). if wanted alter classpath 1 of those, adjust dependencyclasspath in compile or dependencyclasspath in runtime example.
there’s nil add together build.sbt utilize unmanaged dependencies, though alter unmanagedbase key if you’d utilize different directory rather lib.
to utilize custom_lib instead of lib:
unmanagedbase := basedirectory.value / "custom_lib"
basedirectory project’s root directory, here you’re changing unmanagedbase depending on basedirectory using special value method explained in more kinds of setting.
there’s unmanagedjars task lists jars unmanagedbase directory. if wanted utilize multiple directories or else complex, might need replace whole unmanagedjars task 1 else.
to test if works run sbt externally (outside of intellij cmd) , execute update
or compile
tasks. if library used in code , no errors sbt happy. afterwards utilize "import project" in intellij , select "use auto-import" alternative in 1 of wizard steps.
scala sbt
No comments:
Post a Comment