Exclude rules using PMD Extension

Gradle allows us to use external xml file for configuraion and in it usesrs can exclude rules:

<rule ref="rulesets/java/strings.xml">
        <exclude name="AvoidDuplicateLiterals" />
        <exclude name="InefficientEmptyStringCheck" />
</rule>

But in the build script using PMD Extention object we can add rules like:

pmd {
    toolVersion = '5.1.1'
    ignoreFailures = true
    ruleSets = [
            'java-basic',
            'java-braces',
            'java-codesize'
   ]
}

But we can’t exclude part of rule? Or I am wrong? It will be very good if we can exclude rules from the build script something like: exclude=[‘java-string’:’[AvoidDuplicateLiterals’,‘InefficientEmptyStringCheck’]] </code