How to pass secret variables to properties file of a java application


I am setting up a CI/CD pipeline for GitLab. I have few variables I need to set(mysql password for instance) in the properties file, which I need to pass before the gradle build is happening. How can I achieve the same? Or can i set it while deploy?

Jibu Chacko