Class EnforcerRuleUtils
java.lang.Object
org.apache.maven.plugins.enforcer.utils.EnforcerRuleUtils
The Class EnforcerRuleUtils.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.apache.maven.artifact.factory.ArtifactFactory
The factory.private EnforcerRuleHelper
(package private) org.apache.maven.plugin.logging.Log
The log.(package private) org.apache.maven.project.ProjectBuildingRequest
(package private) org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver
The resolver. -
Constructor Summary
ConstructorsConstructorDescriptionEnforcerRuleUtils
(EnforcerRuleHelper helper) Instantiates a new enforcer rule utils. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkIfModelMatches
(String groupId, String artifactId, String version, org.apache.maven.model.Model model) Make sure the model is the one I'm expecting.List<org.apache.maven.model.Model>
getModelsRecursively
(String groupId, String artifactId, String version, File pom) This method loops through all the parents, getting each pom model and then its parent.private org.apache.maven.model.Model
getPomModel
(String groupId, String artifactId, String version, File pom) This method gets the model for the defined artifact.private org.apache.maven.model.Model
Gets the pom model for this file.private void
resolve
(org.apache.maven.model.Plugin plugin) private void
resolve
(org.apache.maven.model.ReportPlugin plugin) List<org.apache.maven.model.Plugin>
resolvePlugins
(List<org.apache.maven.model.Plugin> plugins) List<org.apache.maven.model.ReportPlugin>
resolveReportPlugins
(List<org.apache.maven.model.ReportPlugin> reportPlugins)
-
Field Details
-
factory
org.apache.maven.artifact.factory.ArtifactFactory factoryThe factory. -
resolver
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver resolverThe resolver. -
log
org.apache.maven.plugin.logging.Log logThe log. -
projectBuildingRequest
org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest -
helper
-
-
Constructor Details
-
EnforcerRuleUtils
Instantiates a new enforcer rule utils.- Parameters:
helper
- the helper
-
-
Method Details
-
readModel
private org.apache.maven.model.Model readModel(File pom) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException Gets the pom model for this file.- Parameters:
pom
- the pom- Returns:
- the model
- Throws:
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(String groupId, String artifactId, String version, File pom) throws org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException, IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException This 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 exceptionIOException
- Signals that an I/O exception has occurred.
-
getModelsRecursively
public List<org.apache.maven.model.Model> getModelsRecursively(String groupId, String artifactId, String version, File pom) throws org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException, IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException This 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 exceptionIOException
- Signals that an I/O exception has occurred.org.codehaus.plexus.util.xml.pull.XmlPullParserException
- the xml pull parser exception
-
checkIfModelMatches
protected boolean checkIfModelMatches(String groupId, String artifactId, 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
-
resolveReportPlugins
-