How to fail on republish existing artifacts

Is there a option to let the maven-publish plugin fail if the artifact already exists in the target repository?

Ivy has the ‘overwrite’ option (https://ant.apache.org/ivy/history/2.2.0/use/publish.html) is there something similar in Gradle for the MavenPublication?

Idealy somthing like:

publishing {
    publications {
        mavenJava(MavenPublication) {
           overwrite = false // is something like this possible?
        }
    }
    repositories {
        maven {
            url = "$buildDir/repo"
            overwrite = false // or this?
        }
    }
}

Just to clearify, I know many Repository Managers (like Artifactory) provide this option at repository level. In our case, we have to deal with some legacy software that constantly republishes to a “release” repository, so we can not set this on the repository manager, but for our modern builds we must prevent republishing of release versions and the build should test/fail this on his own instead.