Package org.apache.sling.maven.enforcer
Class RequireProvidedDependenciesInRuntimeClasspath
- java.lang.Object
-
- org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
-
- org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
-
- org.apache.sling.maven.enforcer.RequireProvidedDependenciesInRuntimeClasspath
-
- All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule
,org.apache.maven.enforcer.rule.api.EnforcerRule2
public class RequireProvidedDependenciesInRuntimeClasspath extends org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule implements org.apache.maven.enforcer.rule.api.EnforcerRule2
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 Summary
Constructors Constructor Description RequireProvidedDependenciesInRuntimeClasspath()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean
areArtifactsEqualDisregardingVersion(org.eclipse.aether.artifact.Artifact artifact1, org.eclipse.aether.artifact.Artifact artifact2)
protected int
checkForMissingArtifacts(org.eclipse.aether.graph.DependencyNode rootDependencyNode, List<org.eclipse.aether.artifact.Artifact> runtimeArtifacts, org.apache.maven.plugin.logging.Log log)
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, org.apache.maven.plugin.logging.Log log)
void
execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper helper)
protected static boolean
isCompatibleArtifactContainedInList(org.eclipse.aether.artifact.Artifact artifact, List<org.eclipse.aether.artifact.Artifact> artifacts, org.apache.maven.plugin.logging.Log log)
protected static boolean
isVersionCompatible(String requiredVersion, String providedVersion)
void
setExcludes(List<String> theExcludes)
void
setIncludeDirectDependencies(boolean includeDirects)
void
setIncludeOptionalDependencies(boolean includeOptionals)
-
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
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 interfaceorg.apache.maven.enforcer.rule.api.EnforcerRule
- 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, org.apache.maven.plugin.logging.Log log) 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, org.apache.maven.plugin.logging.Log log)
-
isCompatibleArtifactContainedInList
protected static boolean isCompatibleArtifactContainedInList(org.eclipse.aether.artifact.Artifact artifact, List<org.eclipse.aether.artifact.Artifact> artifacts, org.apache.maven.plugin.logging.Log 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 artifactartifact2
- the other artifact- Returns:
true
in case both artifact's groupId, artifactId, classifier and extension are equals, otherwisefalse
-
setIncludeOptionalDependencies
public void setIncludeOptionalDependencies(boolean includeOptionals)
-
setIncludeDirectDependencies
public void setIncludeDirectDependencies(boolean includeDirects)
-
-