Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a quote from the Josh Suereth <a href="http://www.manning.com/suereth2/">book</a></p> <blockquote> <p>Defining Dependencies sbt provides a convenient syntax for defining Maven/Ivy dependencies using the % method. To define a ModuleID in sbt, just write “groupId” % “artifactId” % “version” and it will automatically become an instance of a ModuleID.</p> </blockquote> <p>Consider this dependency:</p> <pre><code>libraryDependencies += "iv.alex" % "commons" % "100500" </code></pre> <p>In this line we have three parts:</p> <pre><code>libraryDependencies - setting key += - operator "iv.alex" % "commons" % "100500" - initialization part </code></pre> <p>This initialization part constructs a <code>ModuleID</code>, which is required by <code>libraryDependencies</code> setting key. It consists from other three parts from the quote:</p> <pre><code>"iv.alex" - groupId "commons" - artifactId "100500" - version </code></pre> <p>But <code>libraryDependencies</code> key is actually a <code>Seq[ModuleID]</code>, so you have the second operator <code>++=</code> which expects a sequence of moduleIds:</p> <pre><code>libraryDependencies ++= Seq("group" % "artifact" % "version", etc...) </code></pre> <p>The most common way is to store dependencies in stores like <a href="http://search.maven.org/">maven cetnral</a>. So if you want to add you own dependency, for example you want to find <code>Akka</code> 2.2.3 for scala 2.11, first find it (<a href="http://search.maven.org/#browse%7C411317036">link</a>), then you need to find <code>.pom</code> file or some cases it would be written like <a href="http://mvnrepository.com/artifact/com.typesafe.akka/akka-actor_2.10/2.3-M1">here</a>, so you need the foloowing lines:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;com.typesafe.akka&lt;/groupId&gt; &lt;artifactId&gt;akka-actor_2.10&lt;/artifactId&gt; &lt;version&gt;2.3-M1&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>It is easy to translate into sbt dependency, like i've described above:</p> <pre><code>libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3-M1" </code></pre> <p><strong>Note!</strong> that i've written <code>"com.typesafe.akka" %% "akka-actor"</code> two percentage symbols, it means that i need a library with the same version of scala which i have in my <code>scalaVersion</code> setting key. If you notice in maven style dependency, artifact id contains scala version: <code>akka-actor_2.10</code>, but not in out sbt dependency. If you <strong>don't</strong> have scala version in you artifactId, then you <code>shouldn't</code> write it as <code>%%</code> leave just <strong>one</strong> <code>%</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload