title: How do you use `ProjectRef` to reference a local project in sbt 1.x?
body: <p>There's a lot of vague handwaving in other answers, or things referring to much older versions of sbt (ie. 0.12.x) about this, but no one actually seems to answer the question.</p>
  
  <p>Given I have a folder, and I have run:</p>
  
  <pre><code>sbt new scala/scala-seed.g8
  name [Scala Seed Project]: one
  
  sbt new scala/scala-seed.g8
  name [Scala Seed Project]: two
  </code></pre>
  
  <p>I now have a directory structure that looks like this:</p>
  
  <pre><code>8   ./one/build.sbt
  8   ./one/...
  8   ./two/build.sbt
  8   ./two/...
  80  .
  </code></pre>
  
  <p>Right, so I now go and change the <code>example</code> namespace in <code>one</code> and <code>two</code>, so the code looks like this in the respective <code>Hello.scala</code> files:</p>
  
  <pre><code>package example.two
  
  object Hello extends Greeting {
  }
  
  trait Greeting {
    lazy val greeting: String = "hello two"
  }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>package example.one
  
  object Hello extends Greeting with App {
    println(greeting)
    println(example.two.Hello.greeting)
  }
  
  trait Greeting {
    lazy val greeting: String = "hello one"
  }
  </code></pre>
  
  <p>Now, how exactly do I make the code in <code>one</code> compile and run?</p>
  
  <p>From the reading I've done, it appears I should do something similar to this in <code>one/project/Dependencies.scala</code>:</p>
  
  <pre><code>import sbt._
  
  object Dependencies {
    lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.5"
    lazy val two = ProjectRef(file("../two"), "two") &lt;------------ ADD THIS
  }
  </code></pre>
  
  <p>and this in the <code>one/build.sbt</code>:</p>
  
  <pre><code>import Dependencies._
  
  lazy val root = (project in file("."))
    .dependsOn(two) &lt;--------------------- ADD THIS
    .settings(
      inThisBuild(List(
        organization := "com.example",
        scalaVersion := "2.12.7",
        version      := "0.1.0-SNAPSHOT"
      )),
      name := "one",
      libraryDependencies += scalaTest % Test
    )
  </code></pre>
  
  <p>...but it doesn't work:</p>
  
  <pre><code>92-168-1-4:one doug$ sbt run
  [info] Loading settings for project global-plugins from idea.sbt ...
  [info] Loading global plugins from /Users/doug/.sbt/1.0/plugins
  [info] Loading project definition from /Users/doug/tmp/one/project
  [info] Compiling 1 Scala source to /Users/doug/tmp/one/project/target/scala-2.12/sbt-1.0/classes ...
  [info] Done compiling.
  [info] Loading settings for project root from build.sbt ...
  [info] Loading project definition from /Users/doug/tmp/two/project
  [info] Loading settings for project root from build.sbt ...
  [error] java.lang.RuntimeException: No project 'two' in 'file:/Users/doug/tmp/two/'.
  [error] Valid project IDs: root
  [error]     at scala.sys.package$.error(package.scala:26)
  </code></pre>
  
  <p>What does '[error] Valid project IDs: root' mean?</p>
  
  <p>Am I doing this completely wrong, and should eg. be using <code>sbt publishLocal</code> or something?</p>
  
  <p>I can't find any meaningful documentation on how you're supposed to consume local libraries that are <em>not</em> submodules on the current project; did I miss part of the sbt documentation? </p>
  
  <p>The section on <code>Inter-project dependencies</code> in <a href="https://www.scala-sbt.org/1.x/docs/sbt-reference.pdf" rel="nofollow noreferrer">the 1.x documentation</a> doesn't seem to explain this at all, it just talks about tracking references...</p>
  
  <p>help?</p>