mirror of https://github.com/apache/maven.git
[MNG-7570] Plugin descriptor can carry the required Maven version (#832)
Its value takes precedence over POMs Maven prerequisite
This commit is contained in:
parent
d857c3a915
commit
daa8e16902
|
@ -201,7 +201,11 @@ public class DefaultMavenPluginManager
|
|||
|
||||
pluginDescriptor = extractPluginDescriptor( pluginArtifact, plugin );
|
||||
|
||||
pluginDescriptor.setRequiredMavenVersion( artifact.getProperty( "requiredMavenVersion", null ) );
|
||||
if ( StringUtils.isBlank( pluginDescriptor.getRequiredMavenVersion() ) )
|
||||
{
|
||||
// only take value from underlying POM if plugin descriptor has no explicit Maven requirement
|
||||
pluginDescriptor.setRequiredMavenVersion( artifact.getProperty( "requiredMavenVersion", null ) );
|
||||
}
|
||||
|
||||
pluginDescriptorCache.put( cacheKey, pluginDescriptor );
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public class PluginDescriptorBuilder
|
|||
pluginDescriptor.setIsolatedRealm( extractIsolatedRealm( c ) );
|
||||
pluginDescriptor.setInheritedByDefault( extractInheritedByDefault( c ) );
|
||||
pluginDescriptor.setRequiredJavaVersion( extractRequiredJavaVersion( c ).orElse( null ) );
|
||||
pluginDescriptor.setRequiredMavenVersion( extractRequiredMavenVersion( c ).orElse( null ) );
|
||||
|
||||
pluginDescriptor.addMojos( extractMojos( c, pluginDescriptor ) );
|
||||
|
||||
|
@ -147,6 +148,11 @@ public class PluginDescriptorBuilder
|
|||
return Optional.ofNullable( c.getChild( "requiredJavaVersion" ) ).map( PlexusConfiguration::getValue );
|
||||
}
|
||||
|
||||
private Optional<String> extractRequiredMavenVersion( PlexusConfiguration c )
|
||||
{
|
||||
return Optional.ofNullable( c.getChild( "requiredMavenVersion" ) ).map( PlexusConfiguration::getValue );
|
||||
}
|
||||
|
||||
private List<ComponentDependency> extractComponentDependencies( PlexusConfiguration c )
|
||||
{
|
||||
|
||||
|
|
|
@ -99,6 +99,12 @@ under the License.
|
|||
<description>A version range which specifies the supported Java versions. The same values as for POM profile activation element 'jdk' are allowed, i.e. version ranges, version prefixes and negated version prefixes (starting with '!').</description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>requiredMavenVersion</name>
|
||||
<version>1.1.0+</version>
|
||||
<description>A version range which specifies the supported Maven versions. A version range can either use the usual mathematical syntax "[2.0.10,2.1.0),[3.0,)" or use a single version "2.2.1". The latter is a short form for "[2.2.1,)", i.e. denotes the minimum version required. This value takes precedence over the POMs Maven prerequisite.</description>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field xdoc.separator="blank">
|
||||
<name>mojos</name>
|
||||
<version>1.0.0+</version>
|
||||
|
|
Loading…
Reference in New Issue