title: SBT sub project access root project data (dependency version)
body: <p>I have a multiple <a href="http://github.com/eleflow/uberdata" rel="nofollow noreferrer">project</a>, and I'm creating a class with it's git version in one of my subprojects.</p>
  
  <pre><code>def iUberdataCoreVersion(version: Option[String] = Some("Not a Git Repository"), dir: File) = {
    val file = dir / "UberdataCoreVersion.scala"
    IO.write(
      file,
      s"""package eleflow.uberdata.core\n  object UberdataCoreVersion{\n          val version = "${version.get}"\n
         val sparkVersion = ${allDependencies.value.filter(_.extraString.startsWith("spark")).head.crossVersion}
               |}\n""".stripMargin)
    Seq(file)
  }
  </code></pre>
  
  <p>The dependencies are defined in the root project build.sbt file. I want to add spark version (one of my dependencies) into this file. Is there a way to pass an argument to a sub project build, or to iterate through the dependencies to discover which version of spark am I using?</p>
  
  <p><strong>Update as required in comments</strong></p>
  
  <p>The problem here is that in spark there is two versions, and at version 2 I can create it's context (to access the spark cluster) in a different way than it's in spark 1.</p>
  
  <pre><code>root
   build.sbt
  
  lazy val subProject = project settings (libraryDependencies ++= Seq(
      "org.apache.spark" %% "spark-repl" % sparkVersion)
  </code></pre>
  
  <p>I have 3 sub projects, and the spark version is shared between them, that's why I've configured it this way, otherwise I could have inserted the dependencies into the subproject build file.</p>
  
  <p>Consider that sparkVersion is provided as a build argument.</p>
  
  <pre><code>root
    sub
      build.sbt
  </code></pre>
  
  <p>Here in the subproject I want to create a file that contains the spark version. This can be done in a property file, or in a src code file, as I already do with git code. Can I receive it's value as a val when creating the sub project build?</p>
  
  <p>I can access the spark version through it's context, it has a property for it, but in this specific case I want to do that before creating the context, and that's my problem.</p>