本文整理汇总了Java中org.apache.maven.artifact.repository.metadata.Metadata.getPlugins方法的典型用法代码示例。如果您正苦于以下问题:Java Metadata.getPlugins方法的具体用法?Java Metadata.getPlugins怎么用?Java Metadata.getPlugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.repository.metadata.Metadata
的用法示例。
在下文中一共展示了Metadata.getPlugins方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergePlugins
import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
* Merges "right" plugins into "left", the instances are mutated.
*/
private void mergePlugins(final Metadata left, final Metadata right) {
nullElementFilter(left.getPlugins());
nullElementFilter(right.getPlugins());
for (Plugin plugin : right.getPlugins()) {
boolean found = false;
for (Plugin preExisting : left.getPlugins()) {
if (Objects.equals(preExisting.getArtifactId(), plugin.getArtifactId())
&& Objects.equals(preExisting.getPrefix(), plugin.getPrefix())) {
found = true;
preExisting.setName(plugin.getName());
break;
}
}
if (!found) {
Plugin newPlugin = new Plugin();
newPlugin.setArtifactId(plugin.getArtifactId());
newPlugin.setPrefix(plugin.getPrefix());
newPlugin.setName(plugin.getName());
left.addPlugin(newPlugin);
}
}
}
示例2: getMetadataLastModified
import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public long getMetadataLastModified( String path )
throws IOException, MetadataNotFoundException
{
Metadata metadata = getMetadata( path );
if ( metadata != null )
{
if ( !StringUtils.isEmpty( metadata.getGroupId() ) || !StringUtils.isEmpty( metadata.getArtifactId() )
|| !StringUtils.isEmpty( metadata.getVersion() )
|| ( metadata.getPlugins() != null && !metadata.getPlugins().isEmpty() ) || (
metadata.getVersioning() != null && ( !StringUtils.isEmpty( metadata.getVersioning().getLastUpdated() )
|| !StringUtils.isEmpty( metadata.getVersioning().getLatest() )
|| !StringUtils.isEmpty( metadata.getVersioning().getRelease() )
|| ( metadata.getVersioning().getVersions() != null
&& !metadata.getVersioning().getVersions().isEmpty() ) || ( metadata.getVersioning().getSnapshot()
!= null ) ) ) )
{
return System.currentTimeMillis();
}
}
throw new MetadataNotFoundException( path );
}
示例3: modified
import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
* Minimal checks for modified metadata.
*
* @param originalMetadata from
* @param newMetadata to
* @return true if modified false if identical
*/
private boolean modified(Metadata originalMetadata, Metadata newMetadata) {
if (originalMetadata == null) {
return true;
}
List originalPlugins = originalMetadata.getPlugins();
if (originalPlugins.size() != newMetadata.getPlugins().size()) {
return true;
}
for (Object pluginObj : newMetadata.getPlugins()) {
if (!hasPlugin(originalMetadata, ((Plugin) pluginObj).getArtifactId())) {
return true;
}
}
return false;
}
示例4: hasPlugin
import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
* @param metadata the plugin pom metadata
* @param artifactId the plugin id to find
* @return true if the input plugin is listed in the metadata plugins
*/
private boolean hasPlugin(Metadata metadata, String artifactId) {
for (Object pluginObj : metadata.getPlugins()) {
if (((Plugin) pluginObj).getArtifactId().equals(artifactId)) {
return true;
}
}
return false;
}
示例5: resolveFromRepository
import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request, RequestTrace trace,
String pluginGroup,
org.sonatype.aether.metadata.Metadata metadata,
ArtifactRepository repository )
{
if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() )
{
try
{
Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE );
Metadata pluginGroupMetadata = metadataReader.read( metadata.getFile(), options );
List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
if ( plugins != null )
{
for ( org.apache.maven.artifact.repository.metadata.Plugin plugin : plugins )
{
if ( request.getPrefix().equals( plugin.getPrefix() ) )
{
return new DefaultPluginPrefixResult( pluginGroup, plugin.getArtifactId(), repository );
}
}
}
}
catch ( IOException e )
{
invalidMetadata( request.getRepositorySession(), trace, metadata, repository, e );
}
}
return null;
}