Class LicenseNameUrlOverrides
java.lang.Object
org.codehaus.mojo.license.download.LicenseNameUrlOverrides
Applies license-name-based URL overrides. When a
license name matches one of the
configured license name patterns, the URL from the matching override is used
instead of the URL originally declared in the dependency's POM. This is useful for redirecting downloads to an
internal mirror or for providing a canonical plain-text URL for well-known licenses that are otherwise only
available as HTML pages.
The overrides are applied in the order they are configured; the first matching override wins.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LicenseNameUrlOverridesAn instance with an empty override list, used as a null-safe default. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFinds the firstLicenseNameUrlOverridematching the givenlicenseName.overrideIfNecessary(String licenseName, String currentUrl) IflicenseNamematches one of the configured name patterns, returns the URL configured for that override; otherwise returnscurrentUrlunchanged (which may benullor blank).overrideIfNecessary(String licenseName, String currentUrl, boolean logOverride) IflicenseNamematches one of the configured name patterns, returns the URL configured for that override; otherwise returnscurrentUrlunchanged (which may benullor blank).
-
Field Details
-
EMPTY
An instance with an empty override list, used as a null-safe default.
-
-
Constructor Details
-
LicenseNameUrlOverrides
-
-
Method Details
-
findMatch
Finds the firstLicenseNameUrlOverridematching the givenlicenseName.- Parameters:
licenseName- the license name as declared in the dependency's POM; may benullor blank- Returns:
- the matching override, or
nullif no match or iflicenseNameis null or blank
-
overrideIfNecessary
IflicenseNamematches one of the configured name patterns, returns the URL configured for that override; otherwise returnscurrentUrlunchanged (which may benullor blank). Applied overrides are logged at INFO level.- Parameters:
licenseName- the license name as declared in the dependency's POM; may benullor blankcurrentUrl- the URL currently associated with the license; may benullor blank- Returns:
- the override URL when the name matches, or
currentUrlwhen there is no match
-
overrideIfNecessary
IflicenseNamematches one of the configured name patterns, returns the URL configured for that override; otherwise returnscurrentUrlunchanged (which may benullor blank).- Parameters:
licenseName- the license name as declared in the dependency's POM; may benullor blankcurrentUrl- the URL currently associated with the license; may benullor blanklogOverride- whether to log the applied override at INFO level- Returns:
- the override URL when the name matches, or
currentUrlwhen there is no match
-