Package org.apache.sling.maven.enforcer
Class RequireProvidedDependenciesInRuntimeClasspath
- java.lang.Object
-
- org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
-
- org.apache.sling.maven.enforcer.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 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)
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)
void
execute()
org.apache.maven.enforcer.rule.api.EnforcerLogger
getLog()
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)
protected static boolean
isVersionCompatible(String requiredVersion, String providedVersion)
void
setExcludes(List<String> theExcludes)
void
setIncludeDirectDependencies(boolean includeDirects)
void
setIncludeOptionalDependencies(boolean includeOptionals)
void
setLog(org.apache.maven.enforcer.rule.api.EnforcerLogger arg0)
-
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.enforcer.rule.api.EnforcerRuleException
- Specified by:
execute
in classorg.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 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)
-
setLog
public void setLog(org.apache.maven.enforcer.rule.api.EnforcerLogger arg0)
- Specified by:
setLog
in interfaceorg.apache.maven.enforcer.rule.api.EnforcerRuleBase
-
getLog
public org.apache.maven.enforcer.rule.api.EnforcerLogger getLog()
-
-