org.apache.maven.model.Plugin.getArtifactId()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中org.apache.maven.model.Plugin.getArtifactId()方法的一些代码示例,展示了Plugin.getArtifactId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getArtifactId()方法的具体详情如下:
包路径:org.apache.maven.model.Plugin
类名称:Plugin
方法名:getArtifactId

Plugin.getArtifactId介绍

[英]Get the artifact ID of the plugin in the repository.
[中]获取存储库中插件的工件ID。

代码示例

代码示例来源:origin: apache/maven

DefaultPluginPrefixResult( Plugin plugin )
{
  groupId = plugin.getGroupId();
  artifactId = plugin.getArtifactId();
}

代码示例来源:origin: apache/maven

private Plugin findPlugin( String groupId, String artifactId, Collection<Plugin> plugins )
{
  for ( Plugin plugin : plugins )
  {
    if ( artifactId.equals( plugin.getArtifactId() ) && groupId.equals( plugin.getGroupId() ) )
    {
      return plugin;
    }
  }
  return null;
}

代码示例来源:origin: apache/maven

private Plugin findPlugin( String groupId, String artifactId, Collection<Plugin> plugins )
{
  for ( Plugin plugin : plugins )
  {
    if ( artifactId.equals( plugin.getArtifactId() ) && groupId.equals( plugin.getGroupId() ) )
    {
      return plugin;
    }
  }
  return null;
}

代码示例来源:origin: apache/maven

private boolean isSitePlugin( Plugin plugin )
{
  return "maven-site-plugin".equals( plugin.getArtifactId() )
    && "org.apache.maven.plugins".equals( plugin.getGroupId() );
}

代码示例来源: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 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, PlexusContainerException cause )
{
  super( message, cause );
  pluginGroupId = plugin.getGroupId();
  pluginArtifactId = plugin.getArtifactId();
  pluginVersion = plugin.getVersion();
}

代码示例来源: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, PlexusConfigurationException cause )
{
  super( message, cause );
  pluginGroupId = plugin.getGroupId();
  pluginArtifactId = plugin.getArtifactId();
  pluginVersion = plugin.getVersion();
}

代码示例来源:origin: apache/maven

private Plugin findPlugin( Plugin plugin, Collection<Plugin> plugins )
{
  return findPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugins );
}

代码示例来源: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

private static String getKey( Plugin plugin, boolean extension )
{
  String version = ArtifactUtils.toSnapshotVersion( plugin.getVersion() );
  return ( extension ? "extension>" : "plugin>" ) + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":"
    + version;
}

代码示例来源:origin: fabric8io/docker-maven-plugin

PluginDescriptor getPluginDescriptor(MavenProject project, Plugin plugin)
  throws InvocationTargetException, IllegalAccessException, MojoFailureException {
  try {
    Method loadPlugin = pluginManager.getClass().getMethod("loadPluginDescriptor",
                            plugin.getClass(),
                            project.getClass(),
                            session.getClass());
    return (PluginDescriptor) loadPlugin.invoke(pluginManager, plugin, project, session);
  } catch (NoSuchMethodException exp) {
    try {
      // Fallback for older Maven versions
      RepositorySystemSession repositorySession = session.getRepositorySession();
      Method loadPlugin = pluginManager.getClass().getMethod("loadPlugin",
                                  plugin.getClass(),
                                  project.getRemotePluginRepositories().getClass(),
                                  repositorySession.getClass());
      return (PluginDescriptor) loadPlugin.invoke(pluginManager, plugin, project.getRemotePluginRepositories(), repositorySession);
    } catch (NoSuchMethodException exp2) {
      throw new MojoFailureException("Cannot load plugin descriptor for plugin " + plugin.getGroupId() + ":" + plugin.getArtifactId(),exp2);
    }
  }
}

代码示例来源: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

if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
  if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )

代码示例来源: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 );
}

相关文章