Since it's a groovy code just go ahead and use a variable, which depends on the version.
String repo = version.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'
...
repository {
repoKey = repo
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}