Hello world JUnit

what is wrong with the build file that the compile fails with

`
thufir@mordor:~/java/hello_gradle$
thufir@mordor:~/java/hello_gradle$ gradle clean;gradle build
:clean UP-TO-DATE

BUILD SUCCESSFUL

Total time: 4.253 secs
:compileJava
/home/thufir/java/hello_gradle/src/main/java/net/bounceme/mordor/hello/TestJunit.java:3: error: package org.junit does not exist
import org.junit.Test;
^
/home/thufir/java/hello_gradle/src/main/java/net/bounceme/mordor/hello/TestJunit.java:4: error: package org.junit does not exist
import static org.junit.Assert.assertEquals;
^
/home/thufir/java/hello_gradle/src/main/java/net/bounceme/mordor/hello/TestJunit.java:4: error: static import only from classes and interfaces
import static org.junit.Assert.assertEquals;
^
/home/thufir/java/hello_gradle/src/main/java/net/bounceme/mordor/hello/TestJunit.java:11: error: cannot find symbol
@Test
^
symbol: class Test
location: class TestJunit
/home/thufir/java/hello_gradle/src/main/java/net/bounceme/mordor/hello/TestJunit.java:13: error: cannot find symbol
assertEquals(message,messageUtil.printMessage());
^
symbol: method assertEquals(String,String)
location: class TestJunit
5 errors
:compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileJava’.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.148 secs
thufir@mordor:~/java/hello_gradle$
thufir@mordor:~/java/hello_gradle$ cat build.gradle
apply plugin: ‘java’

version = "0.5"


repositories {
mavenCentral()

}

dependencies {
testCompile ‘junit:junit:4.8.2’
}

jar {
manifest {
attributes ‘Main-Class’: ‘hello.HelloWorld’
}
}

task hello << {
println ‘hello, world’
}

thufir@mordor:~/java/hello_gradle$

`

The full code is at:

but I’m also looking at:

which works fine with maven.

I wasn’t using the main and test directories correctly. The build works, learning how to run tests now. Code is updated.