How to make gradle to include java sources?

By default, any Jar task only include compiled classes.

You can change that with something like

jar{
  from sourceSets.main.allSource
}

This includes all sources from the main sourceSet to the base jar task.

All tasks of type jar can be tweaked with

tasks.withType(Jar){
  from sourcesets.xxxx.allSource
}