本文整理汇总了Java中org.apache.maven.model.Plugin.getArtifactId方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.getArtifactId方法的具体用法?Java Plugin.getArtifactId怎么用?Java Plugin.getArtifactId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Plugin
的用法示例。
在下文中一共展示了Plugin.getArtifactId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: merge
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
public void merge(
MavenProject project,
Plugin mergePlugin) {
if (mergePlugin.getArtifactId() == null || mergePlugin.getArtifactId().isEmpty()) {
return;
}
List<Plugin> plugins = project.getBuild().getPlugins();
Plugin foundPlugin = null;
for (Plugin plugin : plugins) {
if (mergePlugin.getGroupId().equals(plugin.getGroupId())
&& mergePlugin.getArtifactId().equals(plugin.getArtifactId())) {
foundPlugin = plugin;
break;
}
}
if (foundPlugin == null) {
plugins.add(mergePlugin);
} else {
mergeExecutions(foundPlugin.getExecutions(), mergePlugin.getExecutions());
}
}
示例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 );
}
示例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);
}
示例4: getArtifactId
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Override
public String getArtifactId(final Plugin origin) {
return origin.getArtifactId();
}
示例5: 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 );
}
}
示例6: 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());
}
示例7: 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 );
}
}