title: Running main class in test directory
body: <p>I have a very basic gradle project, and have a test file with main().  The file - "src/test/javaTestRunner.java" is as follows:</p>
  
  <pre><code>import org.junit.runner.JUnitCore;
  import org.junit.runner.Result;
  import org.junit.runner.notification.Failure;
  
  public class TestRunner {
  
      public static void main(String[] args) {
          Result result = JUnitCore.runClasses(TestJunit.class);
  
          for (Failure failure : result.getFailures()) {
              System.out.println(failure.toString());
          }
  
          System.out.println(result.wasSuccessful());
      }
  }
  </code></pre>
  
  <p>The code compiles ("./gradlew classes" and "./gradlew testclasses" works fine).  However, I am not able to execute TestRunner, not able to find the correct way to invoke the above class.  I have tried the following:</p>
  
  <p>./gradlew test --tests TestRunner
  ./gradlew test TestRunner
  ./gradlew TestRunner</p>
  
  <p>"build.gradle" contains the following:</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'application'
  
  repositories {
      jcenter()
  }
  
  dependencies {
      compile 'com.google.guava:guava:21.0'
      testCompile 'junit:junit:4.12'
  }
  
  // Define the main class for the application
  mainClassName = 'MyFirstJavaProgram'
  </code></pre>
  
  <p>Any suggestions.</p>
  
  <p>Thank you,
  Ahmed.</p>