You could very easily use a project property to set the value and pass it via the command line.
mavenSettings {
userSettingsFileName = project.property('maven.settings.location')
}
Then when executing your build:
./gradlew -Pmaven.settings.location=path/to/settings.xml build