0

I have a Scala app developed using IntelliJ. When I try to package it using sbt, I get the following error and it complains about the sqljdbc4 which I have included in my build.sbt file.

> package
[info] Updating {file:/C:/Users/jthomas1/IdeaProjects/AvroToParquet/}avrotoparquet...
[info] Resolving com.microsoft.sqlserver#sqljdbc4;4.0 ...
[warn]  module not found: com.microsoft.sqlserver#sqljdbc4;4.0
[warn] ==== local: tried
[warn]   C:\Users\jthomas1\.ivy2\local\com.microsoft.sqlserver\sqljdbc4\4.0\ivys\ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   C:\Users\jthomas1\.sbt\preloaded\com.microsoft.sqlserver\sqljdbc4\4.0\ivys\ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:/C:/Users/jthomas1/.sbt/preloaded/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
[info] Resolving jline#jline;2.11 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.microsoft.sqlserver#sqljdbc4;4.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]          com.microsoft.sqlserver:sqljdbc4:4.0 (C:\Users\jthomas1\IdeaProjects\AvroToParquet\build.sbt#L13-14)
[warn]            +- default:avrotoparquet_2.11:0.1
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.microsoft.sqlserver#sqljdbc4;4.0: not found
[error] Total time: 4 s, completed Nov 2, 2017 5:18:51 PM

Following from by build.sbt file

name := "AvroToParquet"

version := "0.1"

scalaVersion := "2.11.1"

libraryDependencies += "com.microsoft.sqlserver" 
% "sqljdbc4" % "4.0" 
% "runtime"


libraryDependencies ++= Seq(
  "org.apache.spark" %% "spark-core" % "1.6.1",
  "org.apache.spark" %% "spark-sql" % "1.6.1",
  "org.apache.spark" %% "spark-hive" % "1.6.1"
)

Appreciate your help!

2 Answers2

2

You can add

resolvers += "Clojars" at "http://clojars.org/repo/"

to your build.sbt and it should solve the problem.


Note, that there are similar questions already and in the answers people write

Unfortunately Microsoft doesn't make this artifact available via any maven repository. You need to download the jar from the Microsoft website, and then manually install it into your local maven repository.

So if you don't want to use Clojars repository from above, you can just download this jar from Microsoft and place it in the lib/ folder in your sbt project.

Also see this answer which refers to another artifact for this driver available in Maven Central.

laughedelic
  • 6,230
  • 1
  • 32
  • 41
1

A Microsoft Sql Server JDBC is listed in maven central here.

There is a tab on that page listing sbt info for this jar:

libraryDependencies += "com.microsoft.sqlserver" % "mssql-jdbc" % "7.4.1.jre12"
dstandish
  • 2,328
  • 18
  • 34