Note :
Jars that are added in gradle for those jars only we can download source code in gradle, if we use an external library example JDK then gradle is not going to download the source code for them, you need to add the external zip file to the eclipse to view the source code.
build.gradle
plugins { id 'eclipse' } eclipse { classpath { downloadJavadoc = true downloadSources = true } }
Run the below command to reflect the changes in eclipse
gradle cleanEclipse eclipse