Gradle compileTestJava fails to detect dependency 'import org.apache.http.localserver.LocalTestServer;'

I am pretty new to gradle. I am facing issue while builing my JUnits where I have made use of ‘org.apache.http.localserver.LocalTestServer’

compilation of tests fails with
error: cannot find symbol
import org.apache.http.localserver.LocalTestServer;
symbol: class LocalTestServer
location: package org.apache.http.localserver

Here is entry in my build.gradle dependencies section

testCompile group: ‘org.apache.httpcomponents’, name: ‘httpclient’, version:‘4.3.5’, classifier:‘tests’


Creating a minimal project with the dependency as provided in your question does not have any issue compiling against org.apache.http.localserver.LocalTestServer in the tests.

You have likely left out a significant detail about this build that would allow someone to recreate this and help with the issue.