[MENFORCER-507] Add xsltLocation parameter to ExternalRules (original) (raw)

Add a new optional parameter called xsltLocation to org.apache.maven.enforcer.rules.ExternalRules.

The new parameter points at a location of an XSLT file used to transform the rule document available via location before it is applied.

This is useful, when users want to consume rules defined in an external project, but they need to remove or adapt some of those for the local circumstances.

Example

If location points at the following rule set:

com.google.code.findbugs:jsr305 com.google.guava:listenablefuture

And if xsltLocation points at the following transformation

<xsl:stylesheet version="1.0" xmlns:xsl="" title="undefined" rel="noopener noreferrer">http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes"/>

<xsl:template match="node()|@*"> xsl:copy <xsl:apply-templates select="node()|@*"/>

<xsl:template match= "//bannedDependencies/excludes/exclude[contains(text(), 'com.google.code.findbugs:jsr305')]"/>

Then the effective rule set will look like to following:

com.google.guava:listenablefuture

A PR follows