Exclude specific jars from the auto generated pom.xml uploadarchives mavendeployer

I have the standard uploadArchives task.
uploadArchives { repositories { mavenDeployer {

Objective: exclude specific jars from the auto generated pom. in this case from specific weblogic jars
I have tried multiple options with pom.whenConfigured, but it completely excludes anything.
pom.dependencies.remove(pom.dependencies.find { dep -> dep.artifactId.contains(“weblogic”) })