java - Gradle compileTestJava fails during gradle clean build -


i'm having strange issue gradle build. below details.

i have java-spring boot based multi module gradle project in following structure

  rootprojectdir       subprojecta       subprojectb       subprojectcommon 

the build.gradle file of each 1 of projects below

rootprojectdir build.gradle

dependencies {  compile project(":subprojecta")  compile project(":subprojectb")  compile project(":subprojectcommon")  testcompile('org.springframework.boot:spring-boot-starter-test') } 

subprojecta build.gradle

dependencies {  compile project(":subprojectcommon")  } 

subprojectb build.gradle

dependencies {  compile project(":subprojectcommon")  } 

subprojectcommon build.gradle

dependencies {  compile('org.springframework.boot:spring-boot-starter-actuator')  compile('org.springframework.boot:spring-boot-starter-jdbc')  compile('org.springframework.boot:spring-boot-starter-web')  .....  ..... } 

when execute

gradle clean build

the build failing during compiletestjava phase of subprojecta. subprojecta tests have compile time dependency on classes in subprojectcommon.

if execute following

gradle :subprojecta compiletestjava

the build successful again.

it failing message subprojectcommon classes not resolved.

the strange thing in intellij idea doesn't show compilation issues subprojecta test classes , test executes fine. when execute

gradle clean test

everything works fine.

i tried putting testcompile dependency on subprojectcommon in subprojecta build.gradle this

subprojecta build.gradle

 dependencies {      compile project(":subprojectcommon")      testcompile project(":subprojectcommon")      } 

but still doesn't work

ps:-i have written test cases subprojecta classes.

ides not honor module paths nicely, eclipse, included together, not path problems.

gradle makes clean distinctions between different projects.

so if classes in test folder, may need reference test sets using below:

 testcompile project(":subprojectcommon").sourcesets.test.output 

or

 compile project(":subprojectcommon").sourcesets.test.output 

depending on sourceset using classes other project.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -