how to build classpath from gradle?

I think im missing something obvious here but I can’t seem to get this to work.

my background is mostly sql, databases, and shell scripts. All the java i’ve done so far are small programs in vim and then command line java -classpath /whatever/whatever. building larger programs now so ive moved to eclipse and gradle. i dont want to use command line, eclipse, env, or any other environment to define the classpath. I want to (and my understanding is that i can) define it all in gradle. but when i try and import a class in my its just class not found and all that.

Ive gone through the gradle and buildship api, and i see classpath being used but i cant figure out how to use it properly.

  • how can i define my classpath in build.gradle

  • is there something else/some other way im supposed to be doing this

  • i might be missing the bigger picture, but if i cant do that in gradle why would i use this

  • a bigger question might be whats the difference between build.gradle and my classpath? maybe im incorrectly assuming they serve the same function?

everything commented out is what i tried to use

thanks in advance

apply plugin: 'java-library'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'scala'

eclipse.classpath.file.whenMerged {
    entries += new Library(fileReference(file('C:\programs\spark-2.3.0-bin-hadoop2.7\jars')))

eclipse {
    classpath {
      file {
            whenMerged {
    entries += new Library(fileReference(file('C:\programs\spark-2.3.0-bin-hadoop2.7')))

repositories {

dependencies {
    api 'org.apache.commons:commons-math3:3.6.1'
    implementation ''
    testImplementation 'junit:junit:4.12'

	compile 'org.apache.spark:spark-core_2.11:2.3.0';    
	//compile files("C:\programs\spark-2.3.0-bin-hadoop2.7")	;
	//classpath("C:\programs\spark-2.3.0-bin-hadoop2.7") ;