gradle - Add additional source set to Gretty classpath -


my project contains jar , war module. jar module contains source sets main , generated.

my jar module gradle.build defines source sets listed below:

sourcesets {     generated     main {         compileclasspath += sourcesets.generated.output  // adds sourceset compileclasspath         runtimeclasspath += sourcesets.generated.output  // adds sourceset runtimeclasspath     } } 

and places output of both source sets jar.

jar {     sourcesets.generated.output     sourcesets.main.output } 

within war module i'd use gretty run within build. build.gradle file looks this.

apply plugin: 'war' apply from: "${rootdir}/gradle/gretty.gradle"  gretty {     // supported values:     // 'jetty7', 'jetty8', 'jetty9', 'tomcat7', 'tomcat8'     servletcontainer = 'tomcat8'      httpport = 8081     contextpath = '/wbc'     realm 'wbc-realm'     realmconfigfile 'tomcat-users.xml' }  dependencies {     compile project(':interfaces')      compile "org.atmosphere:atmosphere-runtime:${atmosphereversion}"     compile "org.springframework:spring-web:${springversion}"     compile "javax.servlet:javax.servlet-api:${servletversion}"      runtime "org.slf4j:slf4j-log4j12:${slf4jversion}"     runtime "log4j:log4j:1.2.17" } 

whenever start gretty using gradle --daemon clean apprun gretty fails start tomcat due classnotfoundexception. class located in generated source set of jar module. how can tell gretty add classpath?

try adding output directories of generated gretty classpath:

gretty {   ...   sourcesets.generated.output.each { classpath } } 

Comments