How use/set variant at pur Java/Springboot/Kotlin project

Dear Sir

The Android project has buildtype(rlease/debug ) & Productflavor (dev/stage/prod)

like this
image
image

i found https://stackoverflow.com/ & gradle doc

get those ref :

https://docs.gradle.org/current/userguide/variant_model.html

the post at stackoverflow is too old ,can not use over gradle 6.X.X

so i ref gradle doc to create a demo

But something is wrong !!

as image

i set two variant ( dev/actuator ) and put differnet spring controller class at their sourcesets

but when generate jar/bootjar

  1. can not select taget variant

  2. the jar file only include main sourceset , the class of variants (dev/actuator ) lost

can help me understand & fix it ?

THX

Those are feature variants for libraries.
So you make library A with feature variant X, Y, and Z.
And then you develop application B where you say I want features X and Y of A.
They are not feature variants the spring boot plugin would handle.
Or at least I’d wonder if it does.

Dear Sir

the gradle variant is for libray not for application ?

so it is differnet Andoid gradle Plugin ( andorid application & andorid library all can use buildtype & Productflavor ) ?

can not use in application

THX

Yes, exactly. The AGP buildtypes and flavors have nothing to do with feature variants, but are a completely separate approach exclusive to the AGP.