Java compilation error by Autograder with JAR dependencancy

When I attempt to include a JAR file dependency for my project, the autograder is failing with a compiler error.

The namespace that I am importing is in sinbad.jar and it is in the main/resources folder. The compilation fails because the JAR file isn’t being added to the classpath during compilation.

Here is my build.gradle. What am I doing wrong?

plugins {
id 'java'
}

repositories {
mavenCentral()

flatDir {
dirs 'main/resources'
}
}

// Added implementation, because that was needed to compile the jUnit test case.
dependencies {
testImplementation('org.junit.jupiter:junit-jupiter:5.6.0')
implementation('org.junit.jupiter:junit-jupiter:5.6.0')
implementation files('main/resources/sinbad.jar')
testImplementation(files('main/resources/sinbad.jar'))

}

test {
    useJUnitPlatform()
     testLogging {
events "passed", "skipped", "failed"
}
}
/* Added the whole sourceSets section, so that the source and test files did NOT have to always follow this structure
main/java
test/java

Eclipse puts them all in the src folder by default, so this sourceSets statement will handle where Eclipse puts
them by default, as well as work with the folder structure expected by Gradle.

*/
sourceSets {
main {
java {
srcDirs = ["src", "main/java"]
}
}
test {
java {
srcDirs = ["src", "test/java"]
}
}
}

/* This is in here for debugging purposes. Not strictly needed.
Gives some info on where gradle is currently looking for filess.
*/
task sourceSetProperties {
sourceSets {
main {
println "java.srcDirs = ${java.srcDirs}"
println "resources.srcDirs = ${resources.srcDirs}"
println "java.files = ${java.files.name}"
println "allJava.files = ${allJava.files.name}"
println "resources.files = ${resources.files.name}"
println "allSource.files = ${allSource.files.name}"
}
}
}

Solved this. It was a file directory issue.

© 2017 GitHub, Inc.
with by
GitHub Education