Custom sourceSet gradle build process


(A Nageshwar) #1

Hi All,

Today i am strange when fixing issue in build process with Gradle i have found strange behavior of Gradle in two different environment one is windows and Linux . I have tried various possibilities while debugging. Actually the problem was when i was trying to build a war file some of the package .classes files are missing i.e not available at run time this case only happen in Linux environment but same case doesn’t observed while in windows environment in windows when i unzipped war file i able to see all the .classes file which were missing in Linux environment. But after adding some lines of code ( i.e bold lines in below snippet ) which are bold then i got .classes file in Linux environment.I am not able to found why this has happened could any one please help me out in this regards.

sourceSets {
    gen {
   		java {
        	srcDir 'app/GeneratedSource'
        }
    }
    
    dao {
    	java {
            srcDir 'app/JavaSource'
            exclude 'gov/fd/vc/svc/**'
        }
        compileClasspath += gen.output
        **runtimeClasspath += gen.outp*ut**
    }

    svc {
    	java {
            srcDir 'app/JavaSource'
            exclude 'gov/fd/vc/dao/**'
        }
        compileClasspath += gen.output
        compileClasspath += dao.output
        **runtimeClasspath += gen.output**
       ** runtimeClasspath += dao.output**
    }

     main {
        java {
	    	srcDir 'web/JavaSource'
        }
        resources {
			srcDir 'app/GeneratedSource'
			srcDir 'app/JavaSource'
	    	srcDir 'web/JavaSource'
        }
        compileClasspath += svc.output
        **runtimeClasspath += svc.output**
        **runtimeClasspath += gen.output**
        **runtimeClasspath += dao.output**
    }
}

configurations {
    genCompile.extendsFrom compile
    daoCompile.extendsFrom compile
    svcCompile.extendsFrom compile
}