Hello. I set up a sample gradle project that I would like to include some Clojure with. My build fails during unit test execution on the clojuresque plugin with:
09:52:35.140 [ERROR] [system.err] Exception in thread "main" java.io.FileNotFoundException: Could not locate CustomClojureApplicativeProgrammingFunctions__init.class or CustomClojureApplicativeProgrammingFunctions.clj on classpath., compiling:(CustomClojureApplicativeProgrammingFunctionsTest.clj:4:1)
Here are the relevant sections of my build.gradle file:
buildscript {
ext {
springBootVersion = '1.2.2.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://clojars.org/repo' }
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "com.netflix.nebula:nebula-clojure-plugin:2.2.+"
}
}
apply plugin: ‘java’
apply plugin: ‘eclipse’
apply plugin: ‘idea’
apply plugin: ‘spring-boot’
apply plugin: ‘war’
apply plugin: ‘maven’
apply plugin: ‘groovy’
apply plugin: “nebula-clojure”
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url “http://repo.spring.io/libs-milestone-local” }
maven { url ‘Clojars Repository: /’ }
}
clojure.aotCompile = true
compileClojure {
classpath = project.files(classpath, project.sourceSets.main.resources.srcDirs)
}
clojureTest {
classpath = project.files(classpath, project.sourceSets.test.resources.srcDirs)
}
dependencies {
compile(“org.springframework.boot:spring-boot-starter-web:${springBootVersion}”)
compile("org.clojure:clojure:1.7.0-RC1")
// compile("org.clojure:clojure:1.5.1")
provided("org.springframework.boot:spring-boot-starter-tomcat")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
Now, I also saw this post which is relevant to my problem:
The clojuresque author mentions that the tests look in /src/test/clojure, but I wonder if the tests also look in /src/main/clojure for .clj files? The line that mine is bombing on is the namespace directive inside the test case, where it tries to reference the .clj file that resides in /src/main/clojure so that it can pull in the function definitions that it is exercising the code for:
(use 'CustomClojureApplicativeProgrammingFunctions)
I have tried adding sourceSets to build.gradle in an effort to reference the main code from the test harness, but clojuresque never finds the code in /src/main/clojure, as it fails on task ‘clojuretest’. I am running the gradle build inside of Intellij 13.1. Has anyone else successfully executed clojure tests from Gradle which reference /src/main/clojure .clj files using clojuresque?
Thanks in advance for any insight on this.