Class PomUtils


  • @ThreadSafe
    public final class PomUtils
    extends java.lang.Object
    Author:
    jeremy long
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void analyzePOM​(Dependency dependency, java.io.File pomFile)
      Reads in the pom file and adds elements as evidence to the given dependency.
      static Model readPom​(java.io.File file)
      Reads in the specified POM and converts it to a Model.
      static Model readPom​(java.lang.String path, java.util.jar.JarFile jar)
      Retrieves the specified POM from a jar file and converts it to a Model.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readPom

        public static Model readPom​(java.io.File file)
                             throws AnalysisException
        Reads in the specified POM and converts it to a Model.
        Parameters:
        file - the pom.xml file
        Returns:
        returns an object representation of the POM
        Throws:
        AnalysisException - is thrown if there is an exception extracting or parsing the POM Model object
      • readPom

        public static Model readPom​(java.lang.String path,
                                    java.util.jar.JarFile jar)
                             throws AnalysisException
        Retrieves the specified POM from a jar file and converts it to a Model.
        Parameters:
        path - the path to the pom.xml file within the jar file
        jar - the jar file to extract the pom from
        Returns:
        returns an object representation of the POM
        Throws:
        AnalysisException - is thrown if there is an exception extracting or parsing the POM Model object
      • analyzePOM

        public static void analyzePOM​(Dependency dependency,
                                      java.io.File pomFile)
                               throws AnalysisException
        Reads in the pom file and adds elements as evidence to the given dependency.
        Parameters:
        dependency - the dependency being analyzed
        pomFile - the pom file to read
        Throws:
        AnalysisException - is thrown if there is an exception parsing the pom