Package com.polarion.alm.builder.spi
Class POMFileHelper
java.lang.Object
com.polarion.alm.builder.spi.POMFileHelper
Helper methods for working with POM files.
- Version:
- $Revision$ $Date$
- Author:
- Stepan Roh, Polarion Software
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ILocationconvertModuleLocationToPOMLocation(String module, ILocation pomLoc) Converts <module> location toILocation.static StringconvertPOMFileToModuleLocation(File pomFile, File localDir) Converts POM file to proper <module> location.static ElementfindOrCreateBuilderPluginDOMElement(Element projectElem) static ElementfindOrCreateCompilerPluginDOMElement(Element projectElem) static IBuildArtifactSelectorgetSelectorForPOM(org.apache.maven.model.Model pom, String repoTag) ReturnsIBuildArtifactSelectorfor given POM.static org.apache.maven.model.ModelLoad POM from filesystem.static org.apache.maven.model.ModelloadPOM(InputStream is) Load POM fromInputStream.static voidSave POM to filesystem.static voidupdateSurefirePluginDOMElementIfExists(Element projectElem, List<String> deprecatedSurefireVersions)
-
Field Details
-
DEFAULT_POM_NAME
- See Also:
-
BUILDER_PLUGIN_GROUP_ID
- Since:
- 3.22.2
- See Also:
-
BUILDER_PLUGIN_ARTIFACT_ID
- Since:
- 3.22.2
- See Also:
-
DEFAULT_BUILDER_PLUGIN_VERSION
- Since:
- 3.22.2 needs to be updated each release or figure out how to get current version here.
- See Also:
-
-
Method Details
-
savePOM
Save POM to filesystem.- Parameters:
pom- POMpomFile- destination file- Throws:
IOException- if error occurs
-
loadPOM
public static org.apache.maven.model.Model loadPOM(File pomFile) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException Load POM from filesystem.- Parameters:
pomFile- source file- Returns:
- loaded POM (not
null) - Throws:
IOException- if error occursorg.codehaus.plexus.util.xml.pull.XmlPullParserException- if error occurs
-
loadPOM
public static org.apache.maven.model.Model loadPOM(InputStream is) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException Load POM fromInputStream.- Parameters:
is- input stream- Returns:
- loaded POM (not
null) - Throws:
IOException- if error occursorg.codehaus.plexus.util.xml.pull.XmlPullParserException- if error occurs
-
convertPOMFileToModuleLocation
Converts POM file to proper <module> location.- Parameters:
pomFile- POM filelocalDir- local directory (base for relativization)- Returns:
- module location (not
null)
-
convertModuleLocationToPOMLocation
Converts <module> location toILocation.- Parameters:
module- module locationpomLoc- reference POM file location- Returns:
- proper POM file location for given module (not
null)
-
getSelectorForPOM
public static IBuildArtifactSelector getSelectorForPOM(org.apache.maven.model.Model pom, String repoTag) ReturnsIBuildArtifactSelectorfor given POM.- Parameters:
pom- POMrepoTag- repository tag (can benull)- Returns:
- selector (not
null)
-
findOrCreateBuilderPluginDOMElement
-
findOrCreateCompilerPluginDOMElement
- Since:
- 3.22.2
-
updateSurefirePluginDOMElementIfExists
public static void updateSurefirePluginDOMElementIfExists(@NotNull Element projectElem, @NotNull List<String> deprecatedSurefireVersions) - Parameters:
projectElem- - Element containing the project section from POMdeprecatedSurefireVersions- - list with versions that should be updated for the plugin- Since:
- 3.22.2
-