Extra sourceset not on project output


(Markus Oley) #1

Hi anyone,

We have implemented generators and use them in the same project, so we have to compile the classes, afterwards generating things and do the normal main and test compile. This is our lifecycle, which we implemented with an additional sourceset, which contains the generator classes. These classes are excluded in the main sourceset as well. That works OK so far, but now we ran in a problem… If we want to define multi modul projects these classes are not visible from any project that has defined a dependency to the project with the generators. Can you please give me a hint how this sourceset can be added to the project’s output to be visible in following projects?

Thanks in advance
Cheers
Markus


(Stefan Oehme) #2

Hi Markus,

in the simplest case you just add the output of your generator sourceSet to the contents of the jar

jar.from(sourceSets.myGenerator)

Cheers,
Stefan


(Markus Oley) #3

Hi Stefan,

thank you for your fast answer… That solution did the trick.
Gradle is so flexible and cool, I am exited every day a bit more :slight_smile:

Cheers
Markus