Class POMFileHelper

java.lang.Object
com.polarion.alm.builder.spi.POMFileHelper

public final class POMFileHelper extends Object
Helper methods for working with POM files.
Version:
$Revision$ $Date$
Author:
Stepan Roh, Polarion Software
  • Field Details

    • DEFAULT_POM_NAME

      public static final String DEFAULT_POM_NAME
      See Also:
    • BUILDER_PLUGIN_GROUP_ID

      public static final String BUILDER_PLUGIN_GROUP_ID
      Since:
      3.22.2
      See Also:
    • BUILDER_PLUGIN_ARTIFACT_ID

      public static final String BUILDER_PLUGIN_ARTIFACT_ID
      Since:
      3.22.2
      See Also:
    • DEFAULT_BUILDER_PLUGIN_VERSION

      public static final String 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

      public static void savePOM(org.apache.maven.model.Model pom, File pomFile) throws IOException
      Save POM to filesystem.
      Parameters:
      pom - POM
      pomFile - 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 occurs
      org.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 from InputStream.
      Parameters:
      is - input stream
      Returns:
      loaded POM (not null)
      Throws:
      IOException - if error occurs
      org.codehaus.plexus.util.xml.pull.XmlPullParserException - if error occurs
    • convertPOMFileToModuleLocation

      public static String convertPOMFileToModuleLocation(File pomFile, File localDir)
      Converts POM file to proper <module> location.
      Parameters:
      pomFile - POM file
      localDir - local directory (base for relativization)
      Returns:
      module location (not null)
    • convertModuleLocationToPOMLocation

      public static ILocation convertModuleLocationToPOMLocation(String module, ILocation pomLoc)
      Converts <module> location to ILocation.
      Parameters:
      module - module location
      pomLoc - 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)
      Returns IBuildArtifactSelector for given POM.
      Parameters:
      pom - POM
      repoTag - repository tag (can be null)
      Returns:
      selector (not null)
    • findOrCreateBuilderPluginDOMElement

      @NotNull public static Element findOrCreateBuilderPluginDOMElement(@NotNull Element projectElem)
    • findOrCreateCompilerPluginDOMElement

      @NotNull public static Element findOrCreateCompilerPluginDOMElement(@NotNull Element projectElem)
      Since:
      3.22.2
    • updateSurefirePluginDOMElementIfExists

      public static void updateSurefirePluginDOMElementIfExists(@NotNull Element projectElem, @NotNull List<String> deprecatedSurefireVersions)
      Parameters:
      projectElem - - Element containing the project section from POM
      deprecatedSurefireVersions - - list with versions that should be updated for the plugin
      Since:
      3.22.2