title: Added dependencies to sbt sub-project tasks (e.g. compile, test) not executed
body: <p>With the following build.sbt, containing a root project and a sub-project, I am adding simple tasks that print some text as dependencies to the compile tasks of the root and sub-project:</p>
  
  <pre><code>ThisBuild / scalaVersion := "2.12.6"
  
  lazy val root = (project in file("."))
          .settings(name := "sbt-task-test")
  
  lazy val rootPrintTask = taskKey[Unit]("root print task")
  rootPrintTask := {println("root")}
  (root / Compile / compile) := (root / Compile / compile).dependsOn(rootPrintTask).value
  
  
  lazy val sub = (project in file("sub"))
          .settings(name := "sub")
  
  lazy val subPrintTask = taskKey[Unit]("sub print task")
  subPrintTask := {println("sub")}
  (sub / Compile / compile) := (sub / Compile / compile).dependsOn(subPrintTask).value
  </code></pre>
  
  <p>and project/build.properties:</p>
  
  <pre><code>sbt.version = 1.2.1
  </code></pre>
  
  <p>When compiling the root project, my output is as follows:</p>
  
  <pre><code>[IJ]sbt:sbt-task-test&gt; root/Compile/compile
  root
  [success] Total time: 0 s, completed 21-Aug-2018 11:04:49
  </code></pre>
  
  <p>As you can see the rootPrintTask was executed and printed 'root'</p>
  
  <p>However, when compiling the sub-project, the subPrintTask is not executed and therefore 'sub' is not printed:</p>
  
  <pre><code>[IJ]sbt:sbt-task-test&gt; sub/Compile/compile
  [success] Total time: 0 s, completed 21-Aug-2018 11:04:51
  </code></pre>
  
  <p>This is also verified when inspecting the two compile tasks:</p>
  
  <pre><code>[IJ]sbt:sbt-task-test&gt; inspect root/Compile/compile
  [info] ...
  [info] Dependencies:
  [info]  Compile / manipulateBytecode
  [info]  Compile / enableBinaryCompileAnalysis
  [info]  Compile / compileIncSetup
  [info]  rootPrintTask
  [info] ...
  
  [IJ]sbt:sbt-task-test&gt; inspect sub/Compile/compile
  [info] ...
  [info] Dependencies:
  [info]  sub / Compile / manipulateBytecode
  [info]  sub / Compile / enableBinaryCompileAnalysis
  [info]  sub / Compile / compileIncSetup
  [info] ...
  </code></pre>
  
  <p>Is this expected behaviour, or a bug in the sbt tool?</p>