Package org.apache.maven.shared.archiver
Class BuildHelper
java.lang.Object
org.apache.maven.shared.archiver.BuildHelper
Helper to detect info about build info in a Maven model, as configured in plugins.
- Since:
- 4.0.0-beta-5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdiscoverJavaRelease(org.apache.maven.api.model.Model model) 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.api.model.PlugingetCompilerPlugin(org.apache.maven.api.model.Model model) static org.apache.maven.api.model.PluginGet plugin from model based on coordinatesgroupId:artifactId.static StringgetPluginParameter(org.apache.maven.api.model.Model model, org.apache.maven.api.model.Plugin plugin, String parameter, String defaultValueProperty) Get plugin parameter value if configured in current model.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:
model- not null- Returns:
- the Java release version configured in the model, 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.api.model.Plugin getCompilerPlugin(org.apache.maven.api.model.Model model) -
getPlugin
public static org.apache.maven.api.model.Plugin getPlugin(org.apache.maven.api.model.Model model, String pluginGa) Get plugin from model based on coordinatesgroupId:artifactId.- Parameters:
model- not nullpluginGa-groupId:artifactId- Returns:
- the plugin from build or pluginManagement, if available in project
-
getPluginParameter
public static String getPluginParameter(org.apache.maven.api.model.Model model, org.apache.maven.api.model.Plugin plugin, String parameter, String defaultValueProperty) Get plugin parameter value if configured in current model.- Parameters:
model- 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.
-