Empty jar after overriding sourceSet property in build.gradle

(dusiabh) #1

Hi, I’m trying use Gradle for build existing system.

I have: …

sourceSets {

main {

java {

srcDir ‘test/source/company/uat/test/t1/t2’


include ‘package/p1/driver/myTypes/**/*’


} }

jar {

manifest {

attributes(testKey1: ‘firstValue’, testKey1: ‘secondValue’)


archiveName = ‘myjarname.jar’ }

The build is running without any problem, but in the end I have empy jar file - it’s contains only:


What I’m going wrong? Thank you for your help!

(René Groeschke) #2

Can you put example code in a <code>" tag in the future?

Two thoughts about your snippet. First of all

srcDir 'test/source/company/uat/test/t1/t2'

will add an directory to the already (default) configured source dirs. want you really want might be

srcDirs = [ 'test/source/company/uat/test/t1/t2' ]

I think your jar is empty, because you might have declared the wrong exclude/include pattern. can you check that the java classes you expect to be compiled end up in the build/main/classes directory.

cheers, René