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
-
Method Summary
Modifier and TypeMethodDescriptionstatic ILocation
convertModuleLocationToPOMLocation
(String module, ILocation pomLoc) Converts <module> location toILocation
.static String
convertPOMFileToModuleLocation
(File pomFile, File localDir) Converts POM file to proper <module> location.static Element
findOrCreateBuilderPluginDOMElement
(Element projectElem) static Element
findOrCreateCompilerPluginDOMElement
(Element projectElem) static IBuildArtifactSelector
getSelectorForPOM
(org.apache.maven.model.Model pom, String repoTag) ReturnsIBuildArtifactSelector
for given POM.static org.apache.maven.model.Model
Load POM from filesystem.static org.apache.maven.model.Model
loadPOM
(InputStream is) Load POM fromInputStream
.static void
Save POM to filesystem.static void
updateSurefirePluginDOMElementIfExists
(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) ReturnsIBuildArtifactSelector
for 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
-