当前位置: 首页>>代码示例>>Java>>正文


Java Plugin.getVersion方法代码示例

本文整理汇总了Java中org.apache.maven.model.Plugin.getVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.getVersion方法的具体用法?Java Plugin.getVersion怎么用?Java Plugin.getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Plugin的用法示例。


在下文中一共展示了Plugin.getVersion方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findVersion

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private String findVersion(String groupId, String artifactId) {
    String key = groupId + ":" + artifactId;
    List<Plugin> plugins = new ArrayList<Plugin>();
    if (project != null) {
        List<Plugin> bld = project.getOriginalMavenProject().getBuildPlugins();
        if (bld != null) {
            plugins.addAll(bld);
        }
        if (project.getOriginalMavenProject().getPluginManagement() != null) {
            List<Plugin> pm = project.getOriginalMavenProject().getPluginManagement().getPlugins();
            if (pm != null) {
                plugins.addAll(pm);
            }
        }
    }

    for (Plugin plg : plugins) {
        if (key.equals(plg.getKey())) {
            return plg.getVersion();
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AddPropertyDialog.java

示例2: visitBuildPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Override
public void visitBuildPlugin( Plugin plugin )
{
    if ( isExternal( plugin.getLocation( "" ) ) )
        return;

    String groupId = plugin.getGroupId();
    String artifactId = plugin.getArtifactId();
    String version = plugin.getVersion();
    if ( StringUtils.isEmpty( groupId ) )
        groupId = "org.apache.maven.plugins";
    if ( StringUtils.isEmpty( version ) )
        version = Artifact.DEFAULT_VERSION;

    Artifact pluginArtifact = new DefaultArtifact( groupId, artifactId, version );
    artifacts.add( pluginArtifact );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:18,代码来源:BuildDependencyVisitor.java

示例3: convertPlugin

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private static MavenPlugin convertPlugin(Plugin plugin) {
  List<MavenPluginExecution> executions =
      plugin.getExecutions().stream().map(MavenModelUtil::convertExecution).collect(toList());

  List<MavenKey> dependecies =
      plugin
          .getDependencies()
          .stream()
          .map(
              dependency ->
                  new MavenKey(
                      dependency.getGroupId(),
                      dependency.getArtifactId(),
                      dependency.getVersion()))
          .collect(toList());

  return new MavenPlugin(
      plugin.getGroupId(),
      plugin.getArtifactId(),
      plugin.getVersion(),
      false,
      convertConfiguration(plugin.getConfiguration()),
      executions,
      dependecies);
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:MavenModelUtil.java

示例4: lookupPluginUpdates

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public PluginUpdatesDetails lookupPluginUpdates( Plugin plugin, boolean allowSnapshots )
    throws ArtifactMetadataRetrievalException, InvalidVersionSpecificationException
{
    String version = plugin.getVersion();
    version = version == null ? "LATEST" : version;
    getLog().debug( "Checking " + ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() )
        + " for updates newer than " + version );

    VersionRange versionRange = VersionRange.createFromVersion( version );

    final boolean includeSnapshots = allowSnapshots;

    final ArtifactVersions pluginArtifactVersions =
        lookupArtifactVersions( createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange ),
                                true );

    Set<Dependency> pluginDependencies = new TreeSet<Dependency>( new DependencyComparator() );
    if ( plugin.getDependencies() != null )
    {
        pluginDependencies.addAll( plugin.getDependencies() );
    }
    Map<Dependency, ArtifactVersions> pluginDependencyDetails =
        lookupDependenciesUpdates( pluginDependencies, false );

    return new PluginUpdatesDetails( pluginArtifactVersions, pluginDependencyDetails, includeSnapshots );
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:30,代码来源:DefaultVersionsHelper.java

示例5: lookupPluginUpdates

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public PluginUpdatesDetails lookupPluginUpdates( Plugin plugin, Boolean allowSnapshots )
    throws ArtifactMetadataRetrievalException, InvalidVersionSpecificationException
{
    String version = plugin.getVersion();
    version = version == null ? "LATEST" : version;
    getLog().debug( "Checking " + ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() ) +
                        " for updates newer than " + version );

    VersionRange versionRange = VersionRange.createFromVersion( version );

    final boolean includeSnapshots = Boolean.TRUE.equals( allowSnapshots );

    final ArtifactVersions pluginArtifactVersions =
        lookupArtifactVersions( createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange ),
                                true );

    Set<Dependency> pluginDependencies = new TreeSet<Dependency>( new DependencyComparator() );
    if ( plugin.getDependencies() != null )
    {
        pluginDependencies.addAll( plugin.getDependencies() );
    }
    Map<Dependency, ArtifactVersions> pluginDependencyDetails =
        lookupDependenciesUpdates( pluginDependencies, false );

    return new PluginUpdatesDetails( pluginArtifactVersions, pluginDependencyDetails, includeSnapshots );
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:30,代码来源:DefaultVersionsHelper.java

示例6: apply

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Override
public boolean apply(Plugin p) {
  String version = p.getVersion();
  version = propertyResolver.expandPropertyReferences(version);
  return version != null && MavenVersionUtil.isSnapshot(version);
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:7,代码来源:IsSnapshotPlugin.java

示例7: getVersion

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Override
public String getVersion(final Plugin origin) {
	return origin.getVersion();
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:5,代码来源:PluginAdapter.java

示例8: addPluginAssociations

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
 * Takes a list of {@link org.apache.maven.model.Plugin} instances and adds associations to properties used to
 * define versions of the plugin artifact or any of the plugin dependencies specified in the pom.
 *
 * @param helper Our helper.
 * @param expressionEvaluator Our expression evaluator.
 * @param result The map of {@link org.codehaus.mojo.versions.api.PropertyVersionsBuilder} keyed by property name.
 * @param plugins The list of {@link org.apache.maven.model.Plugin}.
 * @throws ExpressionEvaluationException if an expression cannot be evaluated.
 */
private static void addPluginAssociations( VersionsHelper helper, ExpressionEvaluator expressionEvaluator,
                                           Map<String, PropertyVersionsBuilder> result, List<Plugin> plugins )
    throws ExpressionEvaluationException
{
    if ( plugins == null )
    {
        return;
    }
    for ( Plugin plugin : plugins )
    {
        String version = plugin.getVersion();
        if ( version != null && version.contains( "${" ) && version.indexOf( '}' ) != -1 )
        {
            version = StringUtils.deleteWhitespace( version );
            for ( PropertyVersionsBuilder property : result.values() )
            {
                // any of these could be defined by a property
                final String propertyRef = "${" + property.getName() + "}";
                if ( version.contains( propertyRef ) )
                {
                    String groupId = plugin.getGroupId();
                    if ( groupId == null || groupId.trim().length() == 0 )
                    {
                        // group Id has a special default
                        groupId = APACHE_MAVEN_PLUGINS_GROUPID;
                    }
                    else
                    {
                        groupId = (String) expressionEvaluator.evaluate( groupId );
                    }
                    String artifactId = plugin.getArtifactId();
                    if ( artifactId == null || artifactId.trim().length() == 0 )
                    {
                        // malformed pom
                        continue;
                    }
                    else
                    {
                        artifactId = (String) expressionEvaluator.evaluate( artifactId );
                    }
                    // might as well capture the current value
                    VersionRange versionRange =
                        VersionRange.createFromVersion( (String) expressionEvaluator.evaluate( plugin.getVersion() ) );
                    property.addAssociation( helper.createPluginArtifact( groupId, artifactId, versionRange ),
                                             true );
                    if ( !propertyRef.equals( version ) )
                    {
                        addBounds( property, version, propertyRef, versionRange.toString() );
                    }
                }
            }
        }
        addDependencyAssocations( helper, expressionEvaluator, result, plugin.getDependencies(), true );
    }
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:66,代码来源:PomHelper.java

示例9: toArtifact

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private Artifact toArtifact(Plugin plugin) {
    return new DefaultArtifact(plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, Constants.MAVEN_PLUGIN_TYPE, null, getArtifactHandler());
}
 
开发者ID:sundrio,项目名称:sundrio,代码行数:4,代码来源:GenerateBomMojo.java

示例10: addPluginAssociations

import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
 * Takes a list of {@link org.apache.maven.model.Plugin} instances and adds associations to properties used to
 * define versions of the plugin artifact or any of the plugin dependencies specified in the pom.
 *
 * @param helper              Our helper.
 * @param expressionEvaluator Our expression evaluator.
 * @param result              The map of {@link org.codehaus.mojo.versions.api.PropertyVersionsBuilder} keyed by property name.
 * @param plugins             The list of {@link org.apache.maven.model.Plugin}.
 * @throws ExpressionEvaluationException if an expression cannot be evaluated.
 */
private static void addPluginAssociations( VersionsHelper helper, ExpressionEvaluator expressionEvaluator,
                                           Map<String, PropertyVersionsBuilder> result, List<Plugin> plugins )
    throws ExpressionEvaluationException
{
    if ( plugins == null )
    {
        return;
    }
    for ( Plugin plugin : plugins )
    {
        String version = plugin.getVersion();
        if ( version != null && version.contains( "${" ) && version.indexOf( '}' ) != -1 )
        {
            version = StringUtils.deleteWhitespace( version );
            for ( PropertyVersionsBuilder property : result.values() )
            {
                // any of these could be defined by a property
                final String propertyRef = "${" + property.getName() + "}";
                if ( version.contains( propertyRef ) )
                {
                    String groupId = plugin.getGroupId();
                    if ( groupId == null || groupId.trim().length() == 0 )
                    {
                        // group Id has a special default
                        groupId = APACHE_MAVEN_PLUGINS_GROUPID;
                    }
                    else
                    {
                        groupId = (String) expressionEvaluator.evaluate( groupId );
                    }
                    String artifactId = plugin.getArtifactId();
                    if ( artifactId == null || artifactId.trim().length() == 0 )
                    {
                        // malformed pom
                        continue;
                    }
                    else
                    {
                        artifactId = (String) expressionEvaluator.evaluate( artifactId );
                    }
                    // might as well capture the current value
                    VersionRange versionRange = VersionRange.createFromVersion(
                        (String) expressionEvaluator.evaluate( plugin.getVersion() ) );
                    property.addAssociation( helper.createPluginArtifact( groupId, artifactId, versionRange ),
                                             true );
                    if ( !propertyRef.equals( version ) )
                    {
                        addBounds( property, version, propertyRef, versionRange.toString() );
                    }
                }
            }
        }
        addDependencyAssocations( helper, expressionEvaluator, result, plugin.getDependencies(), true );
    }
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:66,代码来源:PomHelper.java


注:本文中的org.apache.maven.model.Plugin.getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。