本文整理了Java中org.apache.maven.model.Build.getPluginsAsMap()
方法的一些代码示例,展示了Build.getPluginsAsMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Build.getPluginsAsMap()
方法的具体详情如下:
包路径:org.apache.maven.model.Build
类名称:Build
方法名:getPluginsAsMap
暂无
代码示例来源:origin: org.apache.maven/maven-project
public Map getPluginsAsMap()
{
return build.getPluginsAsMap();
}
代码示例来源:origin: apache/maven
public Plugin getPlugin( String pluginKey )
{
return getBuild().getPluginsAsMap().get( pluginKey );
}
代码示例来源:origin: org.apache.maven/maven-project
public void addPlugin( Plugin plugin )
{
Build build = getModelBuild();
if ( !build.getPluginsAsMap().containsKey( plugin.getKey() ) )
{
injectPluginManagementInfo( plugin );
build.addPlugin( plugin );
build.flushPluginMap();
}
}
代码示例来源:origin: zeroturnaround/maven-jrebel-plugin
/**
* Taken from eclipse plugin. Search for the configuration Xpp3 dom of an other plugin.
*
* @param project the current maven project to get the configuration from.
* @param pluginId the group id and artifact id of the plugin to search for
* @return the value of the plugin configuration
*/
private static Xpp3Dom getPluginConfigurationDom(MavenProject project, String pluginId) {
Plugin plugin = project.getBuild().getPluginsAsMap().get(pluginId);
if (plugin != null) {
return (Xpp3Dom) plugin.getConfiguration();
}
return null;
}
代码示例来源:origin: org.apache.maven.plugins/maven-eclipse-plugin
/**
* Search for the configuration Xpp3 dom of an other plugin.
*
* @todo there should be a better way to do this
* @param project the current maven project to get the configuration from.
* @param pluginId the group id and artifact id of the plugin to search for
* @return the value of the option configured in the plugin configuration
*/
public static Xpp3Dom getPluginConfigurationDom( MavenProject project, String pluginId )
{
Plugin plugin = (org.apache.maven.model.Plugin) project.getBuild().getPluginsAsMap().get( pluginId );
if ( plugin != null )
{
// TODO: This may cause ClassCastExceptions eventually, if the dom impls differ.
return (Xpp3Dom) plugin.getConfiguration();
}
return null;
}
代码示例来源:origin: org.apache.maven.plugins/maven-checkstyle-plugin
private List<Artifact> collectArtifacts( String hint )
{
List<Artifact> artifacts = new ArrayList<>();
PluginManagement pluginManagement = project.getBuild().getPluginManagement();
if ( pluginManagement != null )
{
artifacts.addAll( getCheckstylePluginDependenciesAsArtifacts( pluginManagement.getPluginsAsMap(), hint ) );
}
artifacts.addAll( getCheckstylePluginDependenciesAsArtifacts( project.getBuild().getPluginsAsMap(), hint ) );
return artifacts;
}
代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven
@Override
public Map<String, Object> getPluginConfiguration(String pluginKey) {
Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap();
Plugin plugin = plugins.get(pluginKey);
if (plugin == null) {
return Collections.emptyMap();
}
// get raw configuration
Xpp3Dom rawConfiguration = (Xpp3Dom) plugin.getConfiguration();
if (rawConfiguration == null) {
return Collections.emptyMap();
}
return toMappedConfiguration(rawConfiguration);
}
代码示例来源:origin: org.apache.maven.plugins/maven-checkstyle-plugin
private List<Artifact> collectArtifacts( String hint )
{
List<Artifact> artifacts = new ArrayList<>();
PluginManagement pluginManagement = project.getBuild().getPluginManagement();
if ( pluginManagement != null )
{
artifacts.addAll( getCheckstylePluginDependenciesAsArtifacts( pluginManagement.getPluginsAsMap(), hint ) );
}
artifacts.addAll( getCheckstylePluginDependenciesAsArtifacts( project.getBuild().getPluginsAsMap(), hint ) );
return artifacts;
}
代码示例来源:origin: shrinkwrap/resolver
@Override
public Map<String, Object> getPluginConfiguration(String pluginKey) {
Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap();
Plugin plugin = plugins.get(pluginKey);
if (plugin == null) {
return Collections.emptyMap();
}
// get raw configuration
Xpp3Dom rawConfiguration = (Xpp3Dom) plugin.getConfiguration();
if (rawConfiguration == null) {
return Collections.emptyMap();
}
return toMappedConfiguration(rawConfiguration);
}
代码示例来源:origin: org.apache.maven.plugins/maven-javadoc-plugin
/**
* @param p not null
* @param pluginId not null key of the plugin defined in {@link org.apache.maven.model.Build#getPluginsAsMap()}
* or in {@link org.apache.maven.model.PluginManagement#getPluginsAsMap()}
* @return the Maven plugin defined in <code>${project.build.plugins}</code> or in
* <code>${project.build.pluginManagement}</code>, or <code>null</code> if not defined.
* @since 2.6
*/
private static Plugin getPlugin( MavenProject p, String pluginId )
{
if ( ( p.getBuild() == null ) || ( p.getBuild().getPluginsAsMap() == null ) )
{
return null;
}
Plugin plugin = p.getBuild().getPluginsAsMap().get( pluginId );
if ( ( plugin == null ) && ( p.getBuild().getPluginManagement() != null ) && (
p.getBuild().getPluginManagement().getPluginsAsMap() != null ) )
{
plugin = p.getBuild().getPluginManagement().getPluginsAsMap().get( pluginId );
}
return plugin;
}
代码示例来源:origin: net.flexmojos.oss/flexmojos-maven-plugin
Map<String, Plugin> plugins = project.getBuild().getPluginsAsMap();
Plugin warPlugin = plugins.get( "org.apache.maven.plugins:maven-war-plugin" );
if ( warPlugin == null )
代码示例来源:origin: org.apache.maven.plugins/maven-project-info-reports-plugin
/**
* @param pluginId The id of the plugin
* @return The information about the plugin.
*/
protected Plugin getPlugin( String pluginId )
{
if ( ( getProject().getBuild() == null ) || ( getProject().getBuild().getPluginsAsMap() == null ) )
{
return null;
}
Plugin plugin = getProject().getBuild().getPluginsAsMap().get( pluginId );
if ( ( plugin == null ) && ( getProject().getBuild().getPluginManagement() != null )
&& ( getProject().getBuild().getPluginManagement().getPluginsAsMap() != null ) )
{
plugin = getProject().getBuild().getPluginManagement().getPluginsAsMap().get( pluginId );
}
return plugin;
}
代码示例来源:origin: org.scala-tools/maven-scala-plugin
@Override
public Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException {
Plugin me = (Plugin) project.getBuild().getPluginsAsMap().get("org.scala-tools:maven-scala-plugin");
Set<Dependency> back = new HashSet<Dependency>();
Dependency dep = new Dependency();
dep.setArtifactId(me.getArtifactId());
dep.setGroupId(me.getGroupId());
dep.setVersion(me.getVersion());
back.add(dep);
back.addAll((Collection<Dependency>) me.getDependencies());
return back;
}
};
代码示例来源:origin: mojohaus/extra-enforcer-rules
/**
* Returns the rule configurations from the <tt>pluginManagement</tt> as well
* as the <tt>plugins</tt> section.
*
* @param build the build to inspect.
* @return configuration of the rules, may be an empty list.
*/
final List<Xpp3Dom> getRuleConfigurations( final Build build )
{
@SuppressWarnings( "unchecked" )
final Map<String, Plugin> plugins = build.getPluginsAsMap();
final List<Xpp3Dom> ruleConfigurationsForPlugins = getRuleConfigurations( plugins );
final PluginManagement pluginManagement = build.getPluginManagement();
if ( pluginManagement != null )
{
@SuppressWarnings( "unchecked" )
final Map<String, Plugin> pluginsFromManagementAsMap = pluginManagement.getPluginsAsMap();
List<Xpp3Dom> ruleConfigurationsFromManagement = getRuleConfigurations( pluginsFromManagementAsMap );
ruleConfigurationsForPlugins.addAll( ruleConfigurationsFromManagement );
}
return ruleConfigurationsForPlugins;
}
代码示例来源:origin: apache/maven-enforcer
/**
* Given a plugin, this will retrieve the matching plugin artifact from the model.
*
* @param plugin plugin to lookup
* @param project project to search
* @return matching plugin, <code>null</code> if not found.
*/
protected Plugin findCurrentPlugin( Plugin plugin, MavenProject project )
{
Plugin found = null;
try
{
Model model = project.getModel();
Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap();
found = plugins.get( plugin.getKey() );
}
catch ( NullPointerException e )
{
// nothing to do here
}
if ( found == null )
{
found = resolvePlugin( plugin, project );
}
return found;
}
代码示例来源:origin: org.apache.maven.enforcer/enforcer-rules
/**
* Given a plugin, this will retrieve the matching plugin artifact from the model.
*
* @param plugin plugin to lookup
* @param project project to search
* @return matching plugin, <code>null</code> if not found.
*/
protected Plugin findCurrentPlugin( Plugin plugin, MavenProject project )
{
Plugin found = null;
try
{
Model model = project.getModel();
@SuppressWarnings( "unchecked" )
Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap();
found = plugins.get( plugin.getKey() );
}
catch ( NullPointerException e )
{
// nothing to do here
}
if ( found == null )
{
found = resolvePlugin( plugin, project );
}
return found;
}
代码示例来源:origin: maoo/maven-tiles
public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints ) {
Map<Object, Object> context = new HashMap<Object, Object>();
if ( hints != null )
{
context.putAll( hints );
}
super.merge(target, source, sourceDominant, hints);
if (source.getBuild() != null) {
super.merge(target, source, sourceDominant,context);
for(Plugin sourcePlugin : source.getBuild().getPlugins()) {
Plugin targetPlugin = target.getBuild().getPluginsAsMap().get(sourcePlugin.getKey());
super.mergePlugin(targetPlugin, sourcePlugin, sourceDominant, context);
Set<Entry<String, PluginExecution>> entrySet = targetPlugin.getExecutionsAsMap().entrySet();
for (Entry<String, PluginExecution> entry : entrySet) {
PluginExecution execution = entry.getValue();
if (execution.getConfiguration() == null) {
execution.setConfiguration(sourcePlugin.getConfiguration());
}
}
}
}
}
}
代码示例来源:origin: org.apache.maven.plugins/maven-plugin-plugin
Plugin compiler = getCompilerPlugin( project.getBuild().getPluginsAsMap() );
if ( compiler == null )
代码示例来源:origin: org.apache.maven.plugins/maven-eclipse-plugin
Plugin plugin = (Plugin) build.getPluginsAsMap().get( eclipsePlugin );
if ( plugin == null && build.getPluginManagement() != null )
代码示例来源:origin: errai/errai
return false;
final Plugin plugin = pom.getBuild().getPluginsAsMap().get(getPluginArtifact().toString());
内容来源于网络,如有侵权,请联系作者删除!