Class EnforcerRuleUtils

java.lang.Object
org.apache.maven.plugins.enforcer.utils.EnforcerRuleUtils

public class EnforcerRuleUtils extends Object
The Class EnforcerRuleUtils.
  • Field Details

    • 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 Details

    • EnforcerRuleUtils

      public EnforcerRuleUtils(EnforcerRuleHelper helper)
      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 id
      artifactId - the artifact id
      version - the version
      pom - the pom
      Returns:
      the pom model
      Throws:
      org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException - the artifact resolution exception
      org.codehaus.plexus.util.xml.pull.XmlPullParserException - the xml pull parser exception
      IOException - 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 id
      artifactId - the artifact id
      version - the version
      pom - the pom
      Returns:
      the models recursively
      Throws:
      org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException - the artifact resolution exception
      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(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 id
      artifactId - the artifact id
      version - the version
      model - 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 List<org.apache.maven.model.Plugin> resolvePlugins(List<org.apache.maven.model.Plugin> plugins)
    • resolveReportPlugins

      public List<org.apache.maven.model.ReportPlugin> resolveReportPlugins(List<org.apache.maven.model.ReportPlugin> reportPlugins)