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

x33g5p2x  于2022-01-16 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(146)

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

Build.addPlugin介绍

暂无

代码示例

代码示例来源:origin: org.apache.maven/maven-project

public void addPlugin( Plugin plugin )
{
  build.addPlugin( plugin );
}

代码示例来源:origin: org.apache.maven/maven-project

private void propagateNewPlugins( MavenProject project )
{
  Build changedBuild = project.getBuild();
  Build dynamicBuild = project.getDynamicBuild();
  
  if ( changedBuild == null || dynamicBuild == null )
  {
    return;
  }
  
  List changedPlugins = changedBuild.getPlugins();
  List dynamicPlugins = dynamicBuild.getPlugins();
  
  if ( changedPlugins != null && dynamicPlugins != null && changedPlugins.size() != dynamicPlugins.size() )
  {
    changedPlugins.removeAll( dynamicPlugins );
    if ( !changedPlugins.isEmpty() )
    {
      for ( Iterator it = changedPlugins.iterator(); it.hasNext(); )
      {
        Plugin plugin = (Plugin) it.next();
        
        dynamicBuild.addPlugin( plugin );
      }
    }
  }
  
  dynamicBuild.flushPluginMap();
}

代码示例来源: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: org.kie.workbench.services/kie-wb-common-compiler-core

private void checkDefaultCompilerPlugin(Build build, PluginsContainer dto) {
  if (!dto.getDefaultCompilerPluginPresent()) {
    //if default maven compiler is not present we add the skip and phase none  to avoid its use
    Plugin disabledDefaultCompiler = MavenAPIUtil.getPlugin(conf.get(ConfigurationKey.MAVEN_COMPILER_PLUGIN_GROUP),
                                conf.get(ConfigurationKey.MAVEN_COMPILER_PLUGIN_ARTIFACT),
                                conf.get(ConfigurationKey.MAVEN_COMPILER_PLUGIN_VERSION));
    MavenAPIUtil.disableMavenCompilerAlreadyPresent(disabledDefaultCompiler);
    build.addPlugin(disabledDefaultCompiler);
    dto.setDefaultCompilerPluginPresent(Boolean.TRUE);
    dto.setOverwritePOM(Boolean.TRUE);
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

/**
 * Wrap execute Mojo function for temporary removing global Cargo configuration
 * before starting AMPS internal Cargo
 */
@VisibleForTesting
protected void executeMojoExcludeProductCargoConfig(Plugin internalCargo, String goal, Xpp3Dom configuration, ExecutionEnvironment env)
    throws MojoExecutionException
{
  // remove application cargo plugin for avoiding amps standalone cargo merges configuration
  Plugin globalCargo = env.getMavenProject().getPlugin("org.codehaus.cargo:cargo-maven2-plugin");
  env.getMavenProject().getBuild().removePlugin(globalCargo);
  env.executeMojo(internalCargo, goal, configuration);
  // restore application cargo plugin for maven next tasks
  if (null != globalCargo)
  {
    env.getMavenProject().getBuild().addPlugin(globalCargo);
  }
}

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-compiler-core

private void checkAlternativeCompilerPlugin(Build build, PluginsContainer dto) {
  if (!dto.getAlternativeCompilerPluginPresent()) {
    build.addPlugin(MavenAPIUtil.getNewCompilerPlugin(conf));
    dto.setAlternativeCompilerPluginPresent(Boolean.TRUE);
    dto.setOverwritePOM(Boolean.TRUE);
  }
}

代码示例来源:origin: org.wso2.maven/org.wso2.maven.core

public static Plugin createPluginEntry(MavenProject project, String groupId, String artifactId, String version,boolean isExtension){
  Plugin plugin = new Plugin();
  plugin.setGroupId(groupId);
  plugin.setArtifactId(artifactId);
  plugin.setVersion(version);
  if (isExtension){
    plugin.setExtensions(true);
  }
  MavenUtils.createMainConfigurationNode(plugin);
  project.getBuild().addPlugin(plugin);
  return plugin;
}

代码示例来源:origin: io.teecube.t3/t3-common

if (plugin == null) {
  pluginBuilder = new PluginBuilder(groupId, artifactId);
  mavenProject.getBuild().addPlugin(pluginBuilder.getPlugin());
} else {
  pluginBuilder = new PluginBuilder(plugin);

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

/**
 * Registers a plugin in a project pom
 * <p/>
 * <p>Adds the plugin if it does not exist or amend its version if it does exist and specified</p>
 *
 * @param pom the project pom
 * @param groupId the plugin group id
 * @param artifactId the plugin artifact id
 * @param version the plugin version
 * @param overrideVersion whether to override the version if the plugin is already registered
 * @return the registered plugin
 */
public static MavenPlugin registerPlugin(MavenProject pom, String groupId, String artifactId, String version, boolean overrideVersion) {
 MavenPlugin plugin = getPlugin(pom, groupId, artifactId);
 if (plugin == null) {
  plugin = new MavenPlugin(groupId, artifactId, version);
 } else if (overrideVersion) {
  plugin.setVersion(version);
 }
 // remove from pom
 unregisterPlugin(pom, groupId, artifactId);
 // register
 pom.getBuild().addPlugin(plugin.getPlugin());
 return plugin;
}

代码示例来源:origin: org.switchyard/switchyard-forge-plugin

Profile buildOpenShiftProfile() throws Exception {
  Model pom = project.getFacet(MavenCoreFacet.class).getPOM();
  Profile profile = new Profile();
  profile.setId(OPEN_SHIFT_PROFILE);
  
  Build build = new Build();
  build.setFinalName(pom.getArtifactId());
  profile.setBuild(build);
  addScannerPlugin(pom, profile);
  Plugin jarPlugin = new Plugin();
  jarPlugin.setGroupId("org.apache.maven.plugins");
  jarPlugin.setArtifactId("maven-jar-plugin");
  jarPlugin.setVersion("2.3.1");
  String pluginConfig = 
      "<configuration>"
      + "<outputDirectory>deployments</outputDirectory>"
      + "</configuration>";
  Xpp3Dom dom = Xpp3DomBuilder.build(new ByteArrayInputStream(pluginConfig.getBytes()), "UTF-8");
  jarPlugin.setConfiguration(dom);
  build.addPlugin(jarPlugin);
  
  return profile;
}

代码示例来源:origin: org.apache.maven.shared/maven-model-converter

build.addPlugin( plugin );
build.addPlugin( plugin );

代码示例来源:origin: com.paypal.butterfly/butterfly-utilities

model.setBuild(new Build());
model.getBuild().addPlugin(plugin);
String details = String.format("Plugin %s:%s%s has been added to POM file %s", groupId, artifactId, (version == null ? "" : ":" + version), relativePomFile);
TOExecutionResult result = TOExecutionResult.success(this, details);

代码示例来源:origin: org.codehaus.mevenide/nb-project

plugin = old;
} else {
  handle.getPOMModel().getBuild().addPlugin(plugin);
  handle.getPOMModel().getBuild().addPlugin(plugin2);

代码示例来源:origin: jenkinsci/custom-war-packager

build.addPlugin(mavenHPIPlugin);
model.setBuild(build);

代码示例来源:origin: org.sonatype.pmaven/pmaven-common

plugin.setArtifactId("pmaven-maven-plugin");
plugin.setVersion("0.7-SNAPSHOT");
model.getBuild().addPlugin(plugin);

代码示例来源:origin: org.codehaus.mevenide/nb-project

plugin = old;
} else {
  handle.getPOMModel().getBuild().addPlugin(plugin);

代码示例来源:origin: org.apache.maven.shared/maven-model-converter

v4Model.getBuild().addPlugin( plugin );
sendInfoMessage( "Adding plugin " + plugin.getGroupId() + ":" + plugin.getArtifactId() );
fireAddPluginEvent( plugin );

代码示例来源:origin: minnal/minnal

plugin.addExecution(execution);
build.addPlugin(plugin);
model.setBuild(build);

代码示例来源:origin: jenkinsci/custom-war-packager

build.addPlugin(mavenHPIPlugin);
model.setBuild(build);

代码示例来源:origin: mojohaus/flatten-maven-plugin

cleanPlugin.setVersion( plugin.getVersion() );
cleanPlugin.setExtensions( true );
cleanBuild.addPlugin( cleanPlugin );

相关文章