Class PomReader
java.lang.Object
org.machanism.machai.project.layout.PomReader
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns properties parsed from pom.xml files.org.apache.maven.model.ModelgetProjectModel(File pomFile) Loads and returns the Maven model from apom.xmlfile.static StringprintModel(org.apache.maven.model.Model model) Serializes a Maven Model to its string (XML) representation.
-
Constructor Details
-
PomReader
public PomReader()
-
-
Method Details
-
getProjectModel
Loads and returns the Maven model from apom.xmlfile.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- ifpom.xmlcannot be processed- See Also:
-
printModel
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
Returns properties parsed from pom.xml files.- Returns:
- map of POM properties
-