Package org.apache.maven.archiver
Class BuildHelper
java.lang.Object
org.apache.maven.archiver.BuildHelper
Helper to detect info about build info in a MavenProject, as configured in plugins.
- Since:
- 3.6.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdiscoverJavaRelease(org.apache.maven.project.MavenProject project) Tries to determine the target Java release from the following sources (until one is found) usereleaseconfiguration oforg.apache.maven.plugins:maven-compiler-pluginusemaven.compiler.release<property usetargetconfiguration oforg.apache.maven.plugins:maven-compiler-pluginusemaven.compiler.targetpropertystatic org.apache.maven.model.PlugingetCompilerPlugin(org.apache.maven.project.MavenProject project) static org.apache.maven.model.PluginGet plugin from project based on coordinatesgroupId:artifactId.static StringgetPluginParameter(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 StringNormalize Java version, for versions 5 to 8 where there is a 1.x alias.
-
Constructor Details
-
BuildHelper
public BuildHelper()
-
-
Method Details
-
discoverJavaRelease
Tries to determine the target Java release from the following sources (until one is found)- use
releaseconfiguration oforg.apache.maven.plugins:maven-compiler-plugin - use
maven.compiler.release<property - use
targetconfiguration oforg.apache.maven.plugins:maven-compiler-plugin - use
maven.compiler.targetproperty
- Parameters:
project- not null- Returns:
- the Java release version configured in the project, or null if not configured
- use
-
normalizeJavaVersion
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 coordinatesgroupId:artifactId.- Parameters:
project- not nullpluginGa-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 nullplugin- can be nullparameter- the parameter name when configured in plugin's configurationdefaultValueProperty- 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.
-