Class PomReader

java.lang.Object
org.machanism.machai.project.layout.PomReader

public class PomReader extends Object
Utility for reading and processing Maven pom.xml files into Maven models.

Provides model parsing, effective POM calculation, property replacement, license detection, and model serialization.

Since:
0.0.2
Author:
Viktor Tovstyi
  • Constructor Details

    • PomReader

      public PomReader()
  • Method Details

    • getProjectModel

      public org.apache.maven.model.Model getProjectModel(File pomFile)
      Loads and returns the Maven model from a pom.xml file.

      Note: despite earlier versions of this class referencing an "effective" build, this implementation currently performs a lightweight parse of the POM after applying property substitutions.

      Parameters:
      pomFile - pom.xml file to parse
      Returns:
      parsed Maven model
      Throws:
      IllegalArgumentException - if pom.xml cannot be processed
      See Also:
    • printModel

      public static String printModel(org.apache.maven.model.Model model) throws IOException
      Serializes a Maven Model to its string (XML) representation.
      Parameters:
      model - Maven Model
      Returns:
      XML string of the model
      Throws:
      IOException - if serialization fails
    • getPomProperties

      public Map<String,String> getPomProperties()
      Returns properties parsed from pom.xml files.
      Returns:
      map of POM properties