Class RequireProvidedDependenciesInRuntimeClasspath

  • All Implemented Interfaces:
    org.apache.maven.enforcer.rule.api.EnforcerRuleBase

    @Named("requireProvidedDependenciesInRuntimeClasspath")
    public class RequireProvidedDependenciesInRuntimeClasspath
    extends org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
    Checks that the runtime classpath (e.g. used by Maven Plugins via the Plugin Classloader) contains all provided dependencies (also the transitive ones). As those are not transitively inherited they need to be declared explicitly in the pom.xml of the using Maven project. This check is useful to make sure that a Maven Plugin has access to all necessary classes at run time.
    • Constructor Detail

      • RequireProvidedDependenciesInRuntimeClasspath

        public RequireProvidedDependenciesInRuntimeClasspath()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.enforcer.rule.api.EnforcerRuleException
        Specified by:
        execute in class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
        Throws:
        org.apache.maven.enforcer.rule.api.EnforcerRuleException
      • collectTransitiveDependencies

        protected org.eclipse.aether.graph.DependencyNode collectTransitiveDependencies​(org.eclipse.aether.graph.Dependency rootDependency,
                                                                                        org.eclipse.aether.RepositorySystem repoSystem,
                                                                                        org.eclipse.aether.RepositorySystemSession repoSession,
                                                                                        List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)
                                                                                 throws org.eclipse.aether.collection.DependencyCollectionException
        Throws:
        org.eclipse.aether.collection.DependencyCollectionException
      • checkForMissingArtifacts

        protected int checkForMissingArtifacts​(org.eclipse.aether.graph.DependencyNode rootDependencyNode,
                                               List<org.eclipse.aether.artifact.Artifact> runtimeArtifacts)
      • isCompatibleArtifactContainedInList

        protected static boolean isCompatibleArtifactContainedInList​(org.eclipse.aether.artifact.Artifact artifact,
                                                                     List<org.eclipse.aether.artifact.Artifact> artifacts,
                                                                     org.apache.maven.enforcer.rule.api.EnforcerLogger log)
                                                              throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
        Throws:
        org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
      • isVersionCompatible

        protected static boolean isVersionCompatible​(String requiredVersion,
                                                     String providedVersion)
                                              throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
        Throws:
        org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
      • areArtifactsEqualDisregardingVersion

        protected static boolean areArtifactsEqualDisregardingVersion​(org.eclipse.aether.artifact.Artifact artifact1,
                                                                      org.eclipse.aether.artifact.Artifact artifact2)
        Parameters:
        artifact1 - one artifact
        artifact2 - the other artifact
        Returns:
        true in case both artifact's groupId, artifactId, classifier and extension are equals, otherwise false
      • setExcludes

        public void setExcludes​(List<String> theExcludes)
      • setIncludeOptionalDependencies

        public void setIncludeOptionalDependencies​(boolean includeOptionals)
      • setIncludeDirectDependencies

        public void setIncludeDirectDependencies​(boolean includeDirects)
      • setLog

        public void setLog​(org.apache.maven.enforcer.rule.api.EnforcerLogger arg0)
        Specified by:
        setLog in interface org.apache.maven.enforcer.rule.api.EnforcerRuleBase
      • getLog

        public org.apache.maven.enforcer.rule.api.EnforcerLogger getLog()