What's the best practices for building debug and release versions using java plugin

We want to build a ‘release’ and ‘debug’ version of the jar using the java plugin. I’m sure others have done this and since I’m a newbie to gradle I was looking for some guidance. I haven’t found any example’s using the java plugin and having different build configs.

The ‘release’ version would compile the java files with “release” options (debug=off). Plus, it would obfuscate and NOT run the tests.

The “debug” version would compile with “debug=on”, no obfuscation and it would run the tests against the debug jar.

It would seem to me that you would want a “debug” and “release” output directory. To hold your .CLASS files. Also, if would have “release” and “debug” dependencies. Therefore, I could run “debug”, “debug”, “debug”, and then “release”. So if there are no changes then the 2nd and 3rd “debug” run does nothing, BUT the 1st release builds in release mode - the up to date-ness of release and debug are separate.