There are many helpful answers here, interesting how much the answers have had to vary and evolve with all the changes in gradle along the way. It gives extra credit to the creators of languages like java where code blocks that worked 10 years ago are still likely to work today.
In any case, while I found this solution above would work:
attributes["Class-Path"] = configurations.compileClasspath.get().joinToString(separator = " ") { it.name }
There is an issue if your build has non-modular jars dependencies, and you have to include an extraJavaModuleInfo{} block. In this case, the above takes a jar like "some_name.jar" and changes it to "some_name-module.jar" which then doesn't exist on your file system. I just finally copied and pasted the exact jar names into a string which is not ideal, but would be interested if anyone finds a solution to the above when having to use the plugin org.gradlex.extra-java-module-info.