How to install slick and all of its dependencies

185 views
Skip to first unread message

Boris Hollas

unread,
Jul 6, 2016, 3:56:37 PM7/6/16
to scala-user
I use the Scala IDE for Eclipse and I want to use slick to connect to a sqlite database. However, the Scala plugin for Eclipse doesn't work with sbt projects so I add the library jars manually to my Scala projects.

Problem: slick has dependencies and if I only add slick_2.11-3.2.0-M1.jar from Maven Central to my project, the compiler reports a missing dependency:
"missing or invalid dependency detected while loading class file 'BasicBackend.class'. Could not access term typesafe in package com, because it (or its dependencies) are missing. Check your build definition for missing or conflicting dependencies."
This doesn't give me a hint what lib may be missing.

On http://slick.lightbend.com/doc/3.1.1/gettingstarted.html, there's an installation guide for sbt projects:

libraryDependencies ++= Seq(
  "com.typesafe.slick" %% "slick" % "3.1.1",
  "org.slf4j" % "slf4j-nop" % "1.6.4"
)


Of course, this doesn't help me with Eclipse. How do I get all libraries that are needed to use slick?

Clint Gilbert

unread,
Jul 6, 2016, 4:09:30 PM7/6/16
to scala...@googlegroups.com
Longtime Eclipse user here. The easiest way is to have SBT drive your
build, and have SBT make Eclipse project files for you. For example, I run

> eclipse with-source=true

from my SBT prompt, then import or refresh the project in Eclipse. To
do this, you need the sbteclipse-plugin for SBT.

Another option is Maven, which Eclipse supports fairly well.

If you decide to manage dependencies manually, you'll have to do the
work that a build tool does, like walk the dependency graph and download
jars.
> --
> You received this message because you are subscribed to the Google
> Groups "scala-user" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to scala-user+...@googlegroups.com
> <mailto:scala-user+...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--



signature.asc

Boris Hollas

unread,
Jul 6, 2016, 4:21:32 PM7/6/16
to scala-user
If I use sbt, can I still click "run" in the Eclipse IDE to build an run my project and view compile errors and output in Eclipse?

How do I convert my Eclipse project into a sbt project?

Clint Gilbert

unread,
Jul 6, 2016, 5:55:57 PM7/6/16
to scala...@googlegroups.com
On 07/06/2016 04:21 PM, Boris Hollas wrote:
> If I use sbt, can I still click "run" in the Eclipse IDE to build an run
> my project and view compile errors and output in Eclipse?

Yes, absolutely. You can debug, too, and more or less everything else
you'd do in your IDE. SBT will just generate Eclipse project files that
point to the dependency jars in SBT's cache.

> How do I convert my Eclipse project into a sbt project?

There's probably no automated way, though I could be wrong. You'll
likely need to make a build.sbt file. I haven't checked in a while, but
there are undoubtedly several SBT startup guides on the web.
signature.asc

Boris Hollas

unread,
Jul 7, 2016, 5:39:53 AM7/7/16
to scala-user
I've spend the whole morning trying to get it work, but it eventually failed:
[error] (*:update) sbt.internal.librarymanagement.ResolveException: unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found
Unfortunately, the maven plugin for Scala and Eclipse has been abandoned, so I'll give up on sbt and slick and use a Java lib instead.

Jasper-M

unread,
Jul 7, 2016, 6:45:23 AM7/7/16
to scala-user
Did you follow the instructions on the github page?

Op donderdag 7 juli 2016 11:39:53 UTC+2 schreef Boris Hollas:

Boris Hollas

unread,
Jul 7, 2016, 7:46:04 AM7/7/16
to scala-user
Yes.

Simon Ochsenreither

unread,
Jul 7, 2016, 8:41:28 PM7/7/16
to scala-user
Which version of SBT are you using?

Simon Ochsenreither

unread,
Jul 7, 2016, 8:49:27 PM7/7/16
to scala-user

I've spend the whole morning trying to get it work, but it eventually failed:
[error] (*:update) sbt.internal.librarymanagement.ResolveException: unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found
Unfortunately, the maven plugin for Scala and Eclipse has been abandoned, so I'll give up on sbt and slick and use a Java lib instead.

I was able to reproduce this error by placing

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

in the wrong file. In which file did you add this command?
Message has been deleted

Boris Hollas

unread,
Jul 8, 2016, 6:36:22 AM7/8/16
to scala-user
I've placed a file plugins.sbt containing

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
in the directory project.

Simon Ochsenreither

unread,
Jul 8, 2016, 9:53:20 AM7/8/16
to scala-user
From which directory are you running sbt? Can you show an example project that shows this issue?

Clint Gilbert

unread,
Jul 8, 2016, 10:05:11 AM7/8/16
to scala...@googlegroups.com
I recommend putting that line in

~/.sbt/0.13/plugins/plugins.sbt

That way the plugin will be available to all projects. You probably
don't want to manually configure IDE support in every project.
signature.asc

Boris Hollas

unread,
Jul 8, 2016, 10:57:32 AM7/8/16
to scala-user
Now I've created a simple Hello-project and I get the same error with sbt.

~/progs/sbt/Hello$ tree
.
├── build.sbt
├── lib
├── project
│   ├── plugins.sbt
│   ├── project
│   │   └── target
│   │       └── config-classes
│   │           ├── $09cd59d72d270917bdb0.cache
│   │           ├── $09cd59d72d270917bdb0.class
│   │           └── $09cd59d72d270917bdb0$.class
│   └── target
│       ├── resolution-cache
│       │   ├── default
│       │   │   └── hello-build
│       │   │       └── scala_2.11
│       │   │           └── sbt_1.0.0-M4
│       │   │               └── 0.1-SNAPSHOT
│       │   │                   ├── resolved.xml.properties
│       │   │                   └── resolved.xml.xml
│       │   └── reports
│       │       ├── default-hello-build-compile-internal.xml
│       │       ├── default-hello-build-compile.xml
│       │       ├── default-hello-build-optional.xml
│       │       ├── default-hello-build-plugin.xml
│       │       ├── default-hello-build-pom.xml
│       │       ├── default-hello-build-provided.xml
│       │       ├── default-hello-build-runtime-internal.xml
│       │       ├── default-hello-build-runtime.xml
│       │       ├── default-hello-build-scala-tool.xml
│       │       ├── default-hello-build-test-internal.xml
│       │       ├── default-hello-build-test.xml
│       │       ├── ivy-report.css
│       │       └── ivy-report.xsl
│       └── streams
│           ├── compile
│           │   ├── compile
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── out
│           │   ├── unmanagedClasspath
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── export
│           │   └── unmanagedJars
│           │       └── $global
│           │           └── streams
│           │               └── export
│           ├── $global
│           │   ├── dependencyPositions
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── update_cache_2.11
│           │   │               ├── input_dsp
│           │   │               └── output_dsp
│           │   ├── $global
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── out
│           │   ├── ivyConfiguration
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── out
│           │   ├── ivySbt
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── out
│           │   ├── projectDescriptors
│           │   │   └── $global
│           │   │       └── streams
│           │   │           └── out
│           │   ├── update
│           │   │   └── $global
│           │   │       └── streams
│           │   │           ├── out
│           │   │           └── update_cache_2.11
│           │   └── updateSbtClassifiers
│           │       └── $global
│           │           └── streams
│           │               └── out
│           └── runtime
│               ├── unmanagedClasspath
│               │   └── $global
│               │       └── streams
│               │           └── export
│               └── unmanagedJars
│                   └── $global
│                       └── streams
│                           └── export
├── src
│   ├── main
│   │   ├── Hello.scala
│   │   ├── java
│   │   ├── resources
│   │   └── scala
│   └── test
│       ├── java
│       ├── resources
│       └── scala
└── target

65 directories, 34 files

Simon Ochsenreither

unread,
Jul 8, 2016, 4:22:54 PM7/8/16
to scala-user
Can you upload this as a zip file somewhere? Then I would try it on my machine!

Boris Hollas

unread,
Jul 9, 2016, 2:11:34 AM7/9/16
to scala-user

Patrick Roemer

unread,
Jul 9, 2016, 8:28:48 AM7/9/16
to scala...@googlegroups.com
Responding to Boris Hollas:
> http://www.file-upload.net/download-11751379/Hello.tgz.html

Works for me.

<snip>
$> scala -version
Scala code runner version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL
$> tar -xzf Hello.tgz
$> cd Hello
$> find . -type d -name target|xargs rm -r
$> sbt sbtVersion scalaVersion
[...]
[info] 0.13.11
[info] 2.11.8
$> sbt eclipse
[info] Loading project definition from
/home/patrick/unpack/sbtissue/Hello/project
[info] Set current project to Hello (in build
file:/home/patrick/unpack/sbtissue/Hello/)
[info] About to create Eclipse project files for your project(s).
[info] Updating {file:/home/patrick/unpack/sbtissue/Hello/}hello...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Successfully created Eclipse project files for project(s):
[info] Hello
$> ls -l .project .classpath
-rw-rw-r-- 1 patrick patrick 553 Jul 9 14:24 .classpath
-rw-rw-r-- 1 patrick patrick 359 Jul 9 14:24 .project
</snip>

What version of sbt are you using?

Best regards,
Patrick


Naftoli Gugenheim

unread,
Jul 10, 2016, 1:11:47 AM7/10/16
to Boris Hollas, scala-user
Does it list the URLs it tried to download it from?

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.

Boris Hollas

unread,
Jul 10, 2016, 1:53:49 AM7/10/16
to scala-user, quellkris...@gmail.com
I use sbt 1.0.0-M4.

Patrick Roemer

unread,
Jul 10, 2016, 8:31:13 AM7/10/16
to scala...@googlegroups.com
Responding to Boris Hollas:
> I use sbt 1.0.0-M4.

Well, it's not *that* surprising if a 3rd party plugin for a released
version of a framework does not work (and is not registered for use)
with an unreleased new major version of this framework which is still
work in progress.

Yes, the web site may claim "sbt 0.13 and up", but I'd always interpret
"and up" as limited to the scope of the specified major version (and
even this with more than just one grain of salt).

Best regards,
Patrick


Message has been deleted

Naftoli Gugenheim

unread,
Jul 21, 2016, 12:27:21 AM7/21/16
to Boris Hollas, scala-user, quellkris...@gmail.com

What fails to build with 0.13 and why?


On Wed, Jul 13, 2016, 7:57 PM Boris Hollas <hol...@informatik.htw-dresden.de> wrote:
I use sbt 1.0.0-M4 because some projects fail to build with sbt 0.13. However, the current version of sbteclipse fails to build https://travis-ci.org/typesafehub/sbteclipse/branches and users reported problems with sbt 0.13 as well https://github.com/typesafehub/sbteclipse/issues/315.

I've solved my original problem by using JDBC instead and therefore I don't need sbteclipse anymore.

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages