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 String
discoverJavaRelease
(org.apache.maven.project.MavenProject project) Tries to determine the target Java release from the following sources (until one is found) userelease
configuration oforg.apache.maven.plugins:maven-compiler-plugin
usemaven.compiler.release<
property usetarget
configuration oforg.apache.maven.plugins:maven-compiler-plugin
usemaven.compiler.target
propertystatic org.apache.maven.model.Plugin
getCompilerPlugin
(org.apache.maven.project.MavenProject project) static org.apache.maven.model.Plugin
Get plugin from project based on coordinatesgroupId: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.
-
Constructor Details
-
BuildHelper
public BuildHelper()
-
-
Method Details
-
discoverJavaRelease
Tries to determine the target Java release from the following sources (until one is found)- use
release
configuration oforg.apache.maven.plugins:maven-compiler-plugin
- use
maven.compiler.release<
property - use
target
configuration oforg.apache.maven.plugins:maven-compiler-plugin
- use
maven.compiler.target
property
- 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.
-