What is the best way to include my java source code in my jar file?
jar {
from sourceSets.main.java
}
That said, it’s not generally a recommended practice, and will trip up some compilers/tools. For example, you’ll have to configure Gradle’s compile tasks to not compile Java sources found on the compile class path.