title: Play 2.3.x framework doesn't run JUnit tests in child project
body: <p>I am using Play 2.3.4, IDEA 13.1.5 Ultimate and am trying to write some JUnit tests in code structured with <code>activator new experimentApp play-java</code>.</p>
  
  <p>Besides the Root module (which is pretty much unchanged to the original template), there is a Child module to it with standard directory structure so:</p>
  
  <ul>
  <li>sources in <code>src/main/java</code> -> contains 1 class called <code>org.net.ClassOne</code></li>
  <li>tests in   <code>src/main/test</code> -> contains 1 test class called <code>org.net.ClassOneTest</code></li>
  </ul>
  
  <p>Both of these classes are in Child module.</p>
  
  <p>Code for the classes is trivial:</p>
  
  <p>ClassOne:</p>
  
  <blockquote>
    <p>public class ClassOne {</p>
  
  <pre><code>public String test() {
      return "Smoke test";
  } }
  </code></pre>
  </blockquote>
  
  <p>ClassOneTest:</p>
  
  <blockquote>
    <p>public class ClassOneTest {</p>
  
  <pre><code>@Test
  public void simpleCheck() {
      int a = 1 + 1;
      assertThat(a).isEqualTo(2);
  }
  
  @Test
  public void smokeTest() {
      ClassOne smoke = new ClassOne();
      assertThat(smoke.test()).isEqualTo("Smoke test");
  } }
  </code></pre>
  </blockquote>
  
  <p>My Root <code>build.sbt</code> config is this:</p>
  
  <pre><code>.....
  lazy val Root = (project in file("."))
    .enablePlugins(PlayJava)
    .aggregate(child)
    .dependsOn(child)
  
  lazy val child = project in file("Child")
  .....
  </code></pre>
  
  <p>Since the Root module is unchanged from the <code>play-intro-java</code> template, it contains its original classes directly under <code>test/</code> directory and on running <code>activator clean compile test</code> both of the classes get run regularly.</p>
  
  <p>However, the JUnit test in the Child module (the class quoted above) in Child module are completely ignored on <code>activator clean compile test</code>. If I try to run <code>ClassOneTest</code> from IDEA, it runs without errors, which tells me classpath is formed correctly however I am missing some activator/sbt configuration part.</p>
  
  <p>Just to make things totally obvious, running <code>activator clean compile test</code> on:</p>
  
  <ul>
  <li>Root module yields:</li>
  </ul>
  
  <blockquote>
    <p>[info] Done updating. </p>
    
    <p>[info] Compiling 4 Scala sources and 2 Java sources to
    R:\intellij-projects\Root\target\scala-2.11\classes...</p>
    
    <p>[info] Compiling 2 Java sources to
    R:\intellij-projects\Root\target\scala-2.11\test-classes... </p>
    
    <p>[info] Passed: Total 3, Failed 0, Errors 0, Passed 3 [success]  Total
    time: 15 s, completed Oct 7, 2014 10:22:26 AM</p>
  </blockquote>
  
  <ul>
  <li>Child module yields:</li>
  </ul>
  
  <blockquote>
    <p>[info] Done updating.</p>
    
    <p>[info] Compiling 1 Java source to
    R:\intellij-projects\Root\Child\target\scala-2.10\classes...</p>
    
    <p>[success] Total time: 2 s, completed Oct 7, 2014 10:47:11 AM</p>
    
    <p>[info] Compiling 1 Java source to
    R:\intellij-projects\Root\Child\target\scala-2.10\test-classes...</p>
    
    <p>[success] Total time: 1 s, completed Oct 7, 2014 10:47:12 AM</p>
  </blockquote>
  
  <p>So the questions are:</p>
  
  <ul>
  <li>why is <code>activator</code> failing to notice JUnit tests in Child module only? It runs the tests in Root module fine and I would expect <code>activator</code> to pick all tests up when run in Root module, let alone Child module,</li>
  <li>why is <code>activator</code> disregarding the directive <code>scalaVersion in ThisBuild := "2.11.1"</code> placed in Root <code>build.sbt</code>? It is only after I place this expression in Child <code>build.sbt</code>, the classes are compiled in expected directory, i.e. <code>...\scala-2.11\...</code></li>
  </ul>
  
  <p>I have read the other SO questions and:</p>
  
  <ul>
  <li><code>clean</code> doesn't fix the issue</li>
  <li><code>@RunWith(JUnit.class)</code> is not placed in my tests</li>
  </ul>
  
  <hr>
  
  <p>EDIT: As I suspected, after amending the Root <code>build.sbt</code> with</p>
  
  <pre><code>lazy val Child = (project in file("Child")).enablePlugins(PlayJava)
  </code></pre>
  
  <p>and placing the <code>ClassOneTest</code> directly under <code>test/</code> and <code>ClassOne</code> under <code>app/</code>, all the tests are correctly executed when running from Root, so </p>
  
  <p><code>activator clean compile test</code></p>
  
  <p><code>...
  [info] Done updating.
  [info] Compiling 4 Scala sources and 2 Java sources to R:\intellij-projects\Root\target\scala-2.11\classes...
  [success] Total time: 10 s, completed Oct 7, 2014 11:20:40 AM
  [info] Compiling 1 Java source to R:\intellij-projects\Root\Child\target\scala-2.11\test-classes...
  [info] Compiling 2 Java sources to R:\intellij-projects\Root\target\scala-2.11\test-classes...
  [info] Passed: Total 2, Failed 0, Errors 0, Passed 2
  [info] Passed: Total 3, Failed 0, Errors 0, Passed 3
  [success] Total time: 7 s, completed Oct 7, 2014 11:20:47 AM</code></p>
  
  <p>Interestingly, running the <code>activator clean compile test</code> from Child doesn't invoke any tests(?). Surely, there must be a way to tell Play where the test classes are at?</p>