Class BuildHelper

java.lang.Object
org.apache.maven.archiver.BuildHelper

public class BuildHelper extends Object
Helper to detect info about build info in a MavenProject, as configured in plugins.
Since:
3.6.5
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    discoverJavaRelease(org.apache.maven.project.MavenProject project)
    Tries to determine the target Java release from the following sources (until one is found) use release configuration of org.apache.maven.plugins:maven-compiler-plugin use maven.compiler.release< property use target configuration of org.apache.maven.plugins:maven-compiler-plugin use maven.compiler.target property
    static org.apache.maven.model.Plugin
    getCompilerPlugin(org.apache.maven.project.MavenProject project)
     
    static org.apache.maven.model.Plugin
    getPlugin(org.apache.maven.project.MavenProject project, String pluginGa)
    Get plugin from project based on coordinates groupId:artifactId.
    static String
    getPluginParameter(org.apache.maven.project.MavenProject project, org.apache.maven.model.Plugin plugin, String parameter, String defaultValueProperty)
    Get plugin parameter value if configured in current project.
    static String
    Normalize Java version, for versions 5 to 8 where there is a 1.x alias.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BuildHelper

      public BuildHelper()
  • Method Details

    • discoverJavaRelease

      public static String discoverJavaRelease(org.apache.maven.project.MavenProject project)
      Tries to determine the target Java release from the following sources (until one is found)
      1. use release configuration of org.apache.maven.plugins:maven-compiler-plugin
      2. use maven.compiler.release< property
      3. use target configuration of org.apache.maven.plugins:maven-compiler-plugin
      4. use maven.compiler.target property
      Parameters:
      project - not null
      Returns:
      the Java release version configured in the project, or null if not configured
    • normalizeJavaVersion

      public static String normalizeJavaVersion(String jdk)
      Normalize Java version, for versions 5 to 8 where there is a 1.x alias.
      Parameters:
      jdk - can be null
      Returns:
      normalized version if an alias was used
    • getCompilerPlugin

      public static org.apache.maven.model.Plugin getCompilerPlugin(org.apache.maven.project.MavenProject project)
    • getPlugin

      public static org.apache.maven.model.Plugin getPlugin(org.apache.maven.project.MavenProject project, String pluginGa)
      Get plugin from project based on coordinates groupId:artifactId.
      Parameters:
      project - not null
      pluginGa - groupId:artifactId
      Returns:
      the plugin from build or pluginManagement, if available in project
    • getPluginParameter

      public static String getPluginParameter(org.apache.maven.project.MavenProject project, org.apache.maven.model.Plugin plugin, String parameter, String defaultValueProperty)
      Get plugin parameter value if configured in current project.
      Parameters:
      project - not null
      plugin - can be null
      parameter - the parameter name when configured in plugin's configuration
      defaultValueProperty - the property name when default value is used for the plugin parameter
      Returns:
      the value, or null if not configured at all, but using internal default from plugin.