Do you need both jars to be created with a single run of gradle? If not, it could be as easy as using some additional argument to gradle, such as
compileJava { options.debug = project.hasProperty('debugBuild') } gradle assemble -PdebugBuild=true # or falsePdebugBuild See here for documentation: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties
Also not that you might get better help in the gradle forums.