本文整理了Java中org.apache.maven.model.Plugin.getVersion()
方法的一些代码示例,展示了Plugin.getVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getVersion()
方法的具体详情如下:
包路径:org.apache.maven.model.Plugin
类名称:Plugin
方法名:getVersion
[英]Get the version (or valid range of versions) of the plugin to be used.
[中]获取要使用的插件的版本(或有效版本范围)。
代码示例来源:origin: apache/maven
/**
* Gets the identifier of the plugin.
*
* @return The plugin id in the form {@code <groupId>:<artifactId>:<version>}, never {@code null}.
*/
public String getId()
{
StringBuilder id = new StringBuilder( 128 );
id.append( ( getGroupId() == null ) ? "[unknown-group-id]" : getGroupId() );
id.append( ":" );
id.append( ( getArtifactId() == null ) ? "[unknown-artifact-id]" : getArtifactId() );
id.append( ":" );
id.append( ( getVersion() == null ) ? "[unknown-version]" : getVersion() );
return id.toString();
}
代码示例来源:origin: apache/maven
protected void mergePlugin_Version( Plugin target, Plugin source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getVersion();
if ( src != null )
{
if ( sourceDominant || target.getVersion() == null )
{
target.setVersion( src );
target.setLocation( "version", source.getLocation( "version" ) );
}
}
}
代码示例来源:origin: apache/maven
public PluginNotFoundException( Plugin plugin, List<ArtifactRepository> remoteRepositories )
{
super( "Plugin could not be found, please check its coordinates for typos and ensure the required"
+ " plugin repositories are defined in the POM", plugin.getGroupId(), plugin.getArtifactId(),
plugin.getVersion(), "maven-plugin", null, remoteRepositories, null );
this.plugin = plugin;
}
代码示例来源:origin: apache/maven
protected PluginManagerException( Plugin plugin, String message, MavenProject project, Throwable cause )
{
super( message, cause );
this.project = project;
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
}
代码示例来源:origin: apache/maven
public PluginManagerException( Plugin plugin, String message, Throwable cause )
{
super( message, cause );
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
}
代码示例来源:origin: apache/maven
public PluginManagerException( Plugin plugin, String message, MavenProject project )
{
super( message );
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
this.project = project;
}
代码示例来源:origin: apache/maven
public PluginManagerException( Plugin plugin, InvalidVersionSpecificationException cause )
{
super( cause );
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
}
代码示例来源:origin: apache/maven
public PluginManagerException( Plugin plugin, String message, ComponentRepositoryException cause )
{
super( message, cause );
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
}
代码示例来源:origin: apache/maven
public PluginManagerException( Plugin plugin, String message, PlexusContainerException cause )
{
super( message, cause );
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
}
代码示例来源:origin: apache/maven
public String getVersion()
{
if ( mojoDescriptor != null )
{
return mojoDescriptor.getPluginDescriptor().getVersion();
}
return plugin.getVersion();
}
代码示例来源:origin: apache/maven
public PluginManagerException( Plugin plugin, String message, PlexusConfigurationException cause )
{
super( message, cause );
pluginGroupId = plugin.getGroupId();
pluginArtifactId = plugin.getArtifactId();
pluginVersion = plugin.getVersion();
}
代码示例来源:origin: apache/maven
private PluginVersionResult resolveFromProject( PluginVersionRequest request, List<Plugin> plugins )
{
for ( Plugin plugin : plugins )
{
if ( request.getGroupId().equals( plugin.getGroupId() )
&& request.getArtifactId().equals( plugin.getArtifactId() ) )
{
if ( plugin.getVersion() != null )
{
return new DefaultPluginVersionResult( plugin.getVersion() );
}
else
{
return null;
}
}
}
return null;
}
代码示例来源:origin: apache/maven
private static String getKey( Plugin plugin, boolean extension )
{
String version = ArtifactUtils.toSnapshotVersion( plugin.getVersion() );
return ( extension ? "extension>" : "plugin>" ) + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":"
+ version;
}
代码示例来源:origin: apache/maven
public static boolean pluginEquals( Plugin a, Plugin b )
{
return Objects.equals( a.getArtifactId(), b.getArtifactId() ) //
&& Objects.equals( a.getGroupId(), b.getGroupId() ) //
&& Objects.equals( a.getVersion(), b.getVersion() ) //
&& a.isExtensions() == b.isExtensions() //
&& dependenciesEquals( a.getDependencies(), b.getDependencies() );
}
代码示例来源:origin: apache/maven
public PluginArtifact( Plugin plugin, Artifact pluginArtifact )
{
super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null,
new PluginArtifactHandler() );
this.plugin = plugin;
setFile( pluginArtifact.getFile() );
setResolved( true );
}
代码示例来源:origin: apache/maven
public Artifact createPluginArtifact( Plugin plugin )
{
VersionRange versionRange;
try
{
String version = plugin.getVersion();
if ( StringUtils.isEmpty( version ) )
{
version = "RELEASE";
}
versionRange = VersionRange.createFromVersionSpec( version );
}
catch ( InvalidVersionSpecificationException e )
{
return null;
}
return createPluginArtifactX( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
}
代码示例来源:origin: apache/maven
public Artifact createPluginArtifact( Plugin plugin )
{
String version = plugin.getVersion();
if ( StringUtils.isEmpty( version ) )
{
version = "RELEASE";
}
VersionRange versionRange;
try
{
versionRange = VersionRange.createFromVersionSpec( version );
}
catch ( InvalidVersionSpecificationException e )
{
// MNG-5368: Log a message instead of returning 'null' silently.
this.logger.error( String.format(
"Invalid version specification '%s' creating plugin artifact '%s'.",
version, plugin ), e );
return null;
}
return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
}
代码示例来源:origin: apache/maven
private void injectPluginDeclarationFromProject( Plugin plugin, MavenProject project )
{
Plugin pluginInPom = findPlugin( plugin, project.getBuildPlugins() );
if ( pluginInPom == null && project.getPluginManagement() != null )
{
pluginInPom = findPlugin( plugin, project.getPluginManagement().getPlugins() );
}
if ( pluginInPom != null )
{
if ( plugin.getVersion() == null )
{
plugin.setVersion( pluginInPom.getVersion() );
}
plugin.setDependencies( new ArrayList<>( pluginInPom.getDependencies() ) );
}
}
代码示例来源:origin: apache/maven
private Artifact toArtifact( Plugin plugin, RepositorySystemSession session )
{
return new DefaultArtifact( plugin.getGroupId(), plugin.getArtifactId(), null, "jar", plugin.getVersion(),
session.getArtifactTypeRegistry().get( "maven-plugin" ) );
}
代码示例来源:origin: org.apache.maven/maven-project
public static Plugin clonePlugin( Plugin src )
{
Plugin result = null;
if ( src != null )
{
result = new Plugin();
result.setArtifactId( src.getArtifactId() );
result.setConfiguration( cloneConfiguration( src.getConfiguration() ) );
result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) );
result.setExecutions( cloneList( src.getExecutions(), PLUGIN_EXECUTION_CLONER ) );
result.setExtensions( src.isExtensions() );
result.setGroupId( src.getGroupId() );
result.setInherited( src.getInherited() );
result.setVersion( src.getVersion() );
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!