Class RequireExplicitDependencyScope

  • All Implemented Interfaces:
    org.apache.maven.enforcer.rule.api.EnforcerRule, org.apache.maven.enforcer.rule.api.EnforcerRule2

    public class RequireExplicitDependencyScope
    extends org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
    implements org.apache.maven.enforcer.rule.api.EnforcerRule2
    Checks that all dependencies have an explicitly declared scope in the non-effective pom (i.e. without taking inheritance or dependency management into account)/
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute​(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper helper)  
      protected static String formatLocation​(org.apache.maven.model.InputLocation location)
      Creates a string with line/column information for problems originating directly from this POM.
      • Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule

        getCacheId, isCacheable, isResultValid
      • Methods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule

        getLevel, getMessage, setLevel, setMessage
      • Methods inherited from interface org.apache.maven.enforcer.rule.api.EnforcerRule

        getCacheId, isCacheable, isResultValid
      • Methods inherited from interface org.apache.maven.enforcer.rule.api.EnforcerRule2

        getLevel
    • Constructor Detail

      • RequireExplicitDependencyScope

        public RequireExplicitDependencyScope()
    • Method Detail

      • execute

        public void execute​(@Nonnull
                            org.apache.maven.enforcer.rule.api.EnforcerRuleHelper helper)
                     throws org.apache.maven.enforcer.rule.api.EnforcerRuleException
        Specified by:
        execute in interface org.apache.maven.enforcer.rule.api.EnforcerRule
        Throws:
        org.apache.maven.enforcer.rule.api.EnforcerRuleException
      • formatLocation

        protected static String formatLocation​(org.apache.maven.model.InputLocation location)
        Creates a string with line/column information for problems originating directly from this POM. Inspired by ModelProblemUtils.formatLocation(...)
        Parameters:
        location - The location which should be formatted, must not be null.
        Returns:
        The formatted problem location or an empty string if unknown, never null.