java8 gradle2.3 groovy2.4.3
sourceSets {
main {
java { srcDirs = [] } // no source dirs for the java compiler
groovy { srcDir "src" } // compile everything in src/ with groovy
}
test{
java {srcDirs = []}
groovy{ srcDirs = ["src/test/java", "src/test/groovy"] }
}
}
ControllerServiceSpec.groovy: 18: unable to resolve class org.springframework.test.web.servlet.MockMvc
import info.thecodinglive.controller.TeamController
import info.thecodinglive.service.TeamService
import org.junit.runner.RunWith
import org.spockframework.runtime.Sputnik
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Specification
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.http.HttpStatus.*
@RunWith(Sputnik)
class ControllerServiceSpec extends Specification{
def teamController = new TeamController()
def teamService = Mock(TeamService)
MockMvc mockMvc = standaloneSetup(teamController).build()
def setup(){
teamController.teamService = teamService
}
dependency
{compile 'org.codehaus.groovy:groovy-all:2.4.3'
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'org.springframework', name: 'spring-test', version:"$springVersion"
testCompile group: 'org.springframework', name: 'spring-test-mvc', version:'1.0.0.M1'
testCompile "cglib:cglib-nodep:3.1"
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude group: "org.codehaus.groovy"
}
it works compile groovy/java but when i test controller can't find dependencies