public void callPluginGoal(String fullGoal) throws MojoFailureException, MojoExecutionException { String[] parts = splitGoalSpec(fullGoal); Plugin plugin = project.getPlugin(parts[0]); String goal = parts[1]; if (plugin == null) { throw new MojoFailureException("No goal " + fullGoal + " found in pom.xml"); } try { String executionId = null; if (goal != null && goal.length() > 0 && goal.indexOf('#') > -1) { int pos = goal.indexOf('#'); executionId = goal.substring(pos + 1); goal = goal.substring(0, pos); } PluginDescriptor pluginDescriptor = getPluginDescriptor(project, plugin); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal); if (mojoDescriptor == null) { throw new MojoExecutionException("Could not find goal '" + goal + "' in plugin " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion()); } MojoExecution exec = getMojoExecution(executionId, mojoDescriptor); pluginManager.executeMojo(session, exec); } catch (Exception e) { throw new MojoExecutionException("Unable to execute mojo", e); } }
pluginManager.executeMojo( session, mojoExecution );
/** Execute the given mojo. * * @param mojo the mojo to execute. * @throws MojoExecutionException if the mojo cannot be run properly. * @throws MojoFailureException if the build failed. */ public void executeMojo(MojoExecution mojo) throws MojoExecutionException, MojoFailureException { try { this.buildPluginManager.executeMojo(this.session, mojo); } catch (PluginConfigurationException | PluginManagerException e) { throw new MojoFailureException(e.getLocalizedMessage(), e); } }
public void callPluginGoal(String fullGoal) throws MojoFailureException, MojoExecutionException { String[] parts = splitGoalSpec(fullGoal); Plugin plugin = project.getPlugin(parts[0]); String goal = parts[1]; if (plugin == null) { throw new MojoFailureException("No goal " + fullGoal + " found in pom.xml"); } try { String executionId = null; if (goal != null && goal.length() > 0 && goal.indexOf('#') > -1) { int pos = goal.indexOf('#'); executionId = goal.substring(pos + 1); goal = goal.substring(0, pos); } PluginDescriptor pluginDescriptor = getPluginDescriptor(project, plugin); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal); if (mojoDescriptor == null) { throw new MojoExecutionException("Could not find goal '" + goal + "' in plugin " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion()); } MojoExecution exec = getMojoExecution(executionId, mojoDescriptor); pluginManager.executeMojo(session, exec); } catch (Exception e) { throw new MojoExecutionException("Unable to execute mojo", e); } }
env.getPluginManager().executeMojo(session, exec);
env.getPluginManager().executeMojo(session, exec);
env.getPluginManager().executeMojo(session, exec);
@SuppressWarnings("unchecked") protected void startProject(MavenProject project, String executionId, XmlPlexusConfiguration process) throws InvalidPluginDescriptorException, PluginResolutionException, PluginDescriptorParsingException, PluginNotFoundException, PluginConfigurationException, MojoFailureException, MojoExecutionException, PluginManagerException { Plugin plugin = this.project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin"); Xpp3Dom config = getConfiguration(project, executionId); Xpp3Dom processConfig = getProcessConfiguration(process); Xpp3Dom globalConfig = getGlobalConfig(); Xpp3Dom mergedConfig = Xpp3DomUtils.mergeXpp3Dom(processConfig, config); mergedConfig = Xpp3DomUtils.mergeXpp3Dom(mergedConfig, globalConfig); PluginDescriptor pluginDescriptor = this.pluginManager.loadPlugin(plugin, project.getRemotePluginRepositories(), this.repositorySystemSession); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo("start"); MojoExecution mojoExecution = new MojoExecution(mojoDescriptor, mergedConfig); mavenSession.setCurrentProject(project); this.pluginManager.executeMojo(mavenSession, mojoExecution); List<SwarmProcess> launched = (List<SwarmProcess>) mavenSession.getPluginContext(pluginDescriptor, project).get("swarm-process"); List<SwarmProcess> procs = (List<SwarmProcess>) getPluginContext().get("swarm-process"); if (procs == null) { procs = new ArrayList<>(); getPluginContext().put("swarm-process", procs); } procs.addAll(launched); mavenSession.setCurrentProject(this.project); }
plugin_manager.executeMojo(session, exec); } catch (MojoFailureException | MojoExecutionException | PluginConfigurationException | PluginManagerException e) {
plugin_manager.executeMojo(session, exec); } catch (MojoFailureException | MojoExecutionException | PluginConfigurationException | PluginManagerException e) {