Class EnforcerRuleUtils


  • public class EnforcerRuleUtils
    extends java.lang.Object
    The Class EnforcerRuleUtils.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) org.apache.maven.artifact.factory.ArtifactFactory factory
      The factory.
      private EnforcerRuleHelper helper  
      (package private) org.apache.maven.plugin.logging.Log log
      The log.
      (package private) org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest  
      (package private) org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver resolver
      The resolver.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.Model getPomModel​(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.Model readModel​(java.io.File pom)
      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)  
      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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • 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.XmlPullParserException
        Gets 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.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
        java.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.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
        java.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 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 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)