Class EnforcerRuleUtils
- java.lang.Object
-
- org.apache.maven.plugins.enforcer.utils.EnforcerRuleUtils
-
public class EnforcerRuleUtils extends java.lang.ObjectThe Class EnforcerRuleUtils.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.apache.maven.artifact.factory.ArtifactFactoryfactoryThe factory.private EnforcerRuleHelperhelper(package private) org.apache.maven.plugin.logging.LoglogThe log.(package private) org.apache.maven.project.ProjectBuildingRequestprojectBuildingRequest(package private) org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverresolverThe resolver.
-
Constructor Summary
Constructors Constructor Description EnforcerRuleUtils(EnforcerRuleHelper helper)Instantiates a new enforcer rule utils.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckIfModelMatches(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, org.apache.maven.model.Model model)Make sure the model is the one I'm expecting.java.util.List<org.apache.maven.model.Model>getModelsRecursively(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.io.File pom)This method loops through all the parents, getting each pom model and then its parent.private org.apache.maven.model.ModelgetPomModel(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.io.File pom)This method gets the model for the defined artifact.private org.apache.maven.model.ModelreadModel(java.io.File pom)Gets the pom model for this file.private voidresolve(org.apache.maven.model.Plugin plugin)private voidresolve(org.apache.maven.model.ReportPlugin plugin)java.util.List<org.apache.maven.model.Plugin>resolvePlugins(java.util.List<org.apache.maven.model.Plugin> plugins)java.util.List<org.apache.maven.model.ReportPlugin>resolveReportPlugins(java.util.List<org.apache.maven.model.ReportPlugin> reportPlugins)
-
-
-
Field Detail
-
factory
org.apache.maven.artifact.factory.ArtifactFactory factory
The factory.
-
resolver
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver resolver
The resolver.
-
log
org.apache.maven.plugin.logging.Log log
The log.
-
projectBuildingRequest
org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest
-
helper
private EnforcerRuleHelper helper
-
-
Constructor Detail
-
EnforcerRuleUtils
public EnforcerRuleUtils(EnforcerRuleHelper helper)
Instantiates a new enforcer rule utils.- Parameters:
helper- the helper
-
-
Method Detail
-
readModel
private org.apache.maven.model.Model readModel(java.io.File pom) throws java.io.IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionGets the pom model for this file.- Parameters:
pom- the pom- Returns:
- the model
- Throws:
java.io.IOException- Signals that an I/O exception has occurred.org.codehaus.plexus.util.xml.pull.XmlPullParserException- the xml pull parser exception
-
getPomModel
private org.apache.maven.model.Model getPomModel(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.io.File pom) throws org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException, java.io.IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionThis method gets the model for the defined artifact. Looks first in the filesystem, then tries to get it from the repo.- Parameters:
groupId- the group idartifactId- the artifact idversion- the versionpom- the pom- Returns:
- the pom model
- Throws:
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException- the artifact resolution exceptionorg.codehaus.plexus.util.xml.pull.XmlPullParserException- the xml pull parser exceptionjava.io.IOException- Signals that an I/O exception has occurred.
-
getModelsRecursively
public java.util.List<org.apache.maven.model.Model> getModelsRecursively(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.io.File pom) throws org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException, java.io.IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionThis method loops through all the parents, getting each pom model and then its parent.- Parameters:
groupId- the group idartifactId- the artifact idversion- the versionpom- the pom- Returns:
- the models recursively
- Throws:
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException- the artifact resolution exceptionjava.io.IOException- Signals that an I/O exception has occurred.org.codehaus.plexus.util.xml.pull.XmlPullParserException- the xml pull parser exception
-
checkIfModelMatches
protected boolean checkIfModelMatches(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, org.apache.maven.model.Model model)Make sure the model is the one I'm expecting.- Parameters:
groupId- the group idartifactId- the artifact idversion- the versionmodel- Model being checked.- Returns:
- true, if check if model matches
-
resolve
private void resolve(org.apache.maven.model.Plugin plugin)
-
resolve
private void resolve(org.apache.maven.model.ReportPlugin plugin)
-
resolvePlugins
public java.util.List<org.apache.maven.model.Plugin> resolvePlugins(java.util.List<org.apache.maven.model.Plugin> plugins)
-
resolveReportPlugins
public java.util.List<org.apache.maven.model.ReportPlugin> resolveReportPlugins(java.util.List<org.apache.maven.model.ReportPlugin> reportPlugins)
-
-