当前位置: 首页>>代码示例>>Java>>正文


Java MojoExecution.getConfiguration方法代码示例

本文整理汇总了Java中org.apache.maven.plugin.MojoExecution.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java MojoExecution.getConfiguration方法的具体用法?Java MojoExecution.getConfiguration怎么用?Java MojoExecution.getConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.plugin.MojoExecution的用法示例。


在下文中一共展示了MojoExecution.getConfiguration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfigurationParametersToReport

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@Nonnull
@Override
protected List<String> getConfigurationParametersToReport(ExecutionEvent executionEvent) {

    MojoExecution mojoExecution = executionEvent.getMojoExecution();
    if (mojoExecution == null) {
        return Collections.emptyList();
    }

    Xpp3Dom configuration = mojoExecution.getConfiguration();
    List<String> parameters = new ArrayList<String>();
    for (Xpp3Dom configurationParameter : configuration.getChildren()) {
        parameters.add(configurationParameter.getName());
    }
    return parameters;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:17,代码来源:CatchAllExecutionHandler.java

示例2: NarTestCompileBuildParticipant

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public NarTestCompileBuildParticipant(MojoExecution execution, boolean runOnIncremental, boolean runOnConfiguration) {
	super(new MojoExecution(execution.getMojoDescriptor(), execution.getExecutionId(), execution.getSource()), runOnIncremental, runOnConfiguration);
	// Some versions of nar-maven-plugin don't have a nar-test-unpack goal
	// this means the test artifacts won't be available to us.
	// What we need to do is run the nar-testCompile goal without any tests
	// its configuration in order to just unpack.
	Xpp3Dom configuration = new Xpp3Dom(execution.getConfiguration());
	logger.debug("Configuration before: " + configuration);
	for (int i = 0; i < configuration.getChildCount(); ++i) {
		if ("tests".equals(configuration.getChild(i).getName())) {
			configuration.removeChild(i);
			break;
		}
	}
	logger.debug("Configuration after: " + configuration);
	getMojoExecution().setConfiguration(configuration);
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:18,代码来源:NarTestCompileBuildParticipant.java

示例3: processAnnotations

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
protected void processAnnotations(MavenSession session, MavenProject project, String goal, File processor, Proc proc, Xpp3Dom... parameters) throws Exception {
  MojoExecution execution = mojos.newMojoExecution(goal);

  addDependency(project, "processor", new File(processor, "target/classes"));

  Xpp3Dom configuration = execution.getConfiguration();

  if (proc != null) {
    configuration.addChild(newParameter("proc", proc.name()));
  }
  if (parameters != null) {
    for (Xpp3Dom parameter : parameters) {
      configuration.addChild(parameter);
    }
  }

  mojos.executeMojo(session, project, execution);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:19,代码来源:AnnotationProcessingTest.java

示例4: getResourceBundles

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
/**
 * 
 * @param mavenProjectFacade
 * @return
 */
private Set<String> getResourceBundles(IMavenProjectFacade mavenProjectFacade, IProgressMonitor monitor) throws CoreException {
	Set<String> bundles = new HashSet<String>();
	List<MojoExecution> executions = mavenProjectFacade.getMojoExecutions(Activator.MAVEN_GROUP_ID, Activator.MAVEN_ARTIFACT_ID, monitor, "process");
	for (MojoExecution execution : executions) {
		Xpp3Dom node = execution.getConfiguration();
		if (node != null) {
			node = node.getChild("resourceBundles");
			if (node != null) {
				Xpp3Dom[] nodes = node.getChildren("resourceBundle");
				if (nodes != null) {
					for (Xpp3Dom n : nodes) {
						String bundle = n.getValue();
						bundles.add(bundle);
					}
				}
			}
		}
	}
	return bundles;
}
 
开发者ID:dashie,项目名称:m2e-plugins,代码行数:26,代码来源:Configurator.java

示例5: getString

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@CheckForNull
private String getString(MavenProject pom, String parameter) {
  MavenProject oldProject = session.getCurrentProject();
  try {
    // Switch to the project for which we try to resolve the property.
    session.setCurrentProject(pom);
    for (MojoExecution exec : mojoExecutions) {
      Xpp3Dom configuration = exec.getConfiguration();
      PlexusConfiguration pomConfiguration = new XmlPlexusConfiguration(configuration);
      PlexusConfiguration config = pomConfiguration.getChild(parameter);

      ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, exec);
      BasicStringConverter converter = new BasicStringConverter();

      String value = converter.fromExpression(config, expressionEvaluator);
      if (value != null) {
        return value;
      }
    }
  } catch (Exception e) {
    log.warn(String.format("Failed to get parameter '%s' for goal '%s': %s", parameter, COMPILE_GOAL, e.getMessage()));
  } finally {
    session.setCurrentProject(oldProject);
  }

  return null;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:28,代码来源:JavaVersionResolver.java

示例6: compile

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public void compile(MavenSession session, MavenProject project, Xpp3Dom... parameters) throws Exception {
  MojoExecution execution = newMojoExecution();

  if (parameters != null) {
    Xpp3Dom configuration = execution.getConfiguration();
    for (Xpp3Dom parameter : parameters) {
      configuration.addChild(parameter);
    }
  }

  executeMojo(session, project, execution);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:13,代码来源:CompileRule.java

示例7: configure

import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request,
		IProgressMonitor monitor) throws CoreException {
	IProject eclipseProject = request.getProject();

	if (eclipseProject.hasNature(JavaCore.NATURE_ID)) {
		IJavaProject javaProject = JavaCore.create(eclipseProject);

		IMavenProjectFacade mavenProject = request.getMavenProjectFacade();
		List<MojoExecution> executions = mavenProject.getMojoExecutions(
				"com.marvinformatics.formatter", "formatter-maven-plugin",
				monitor, "validate");

		MojoExecution execution = executions.get(0);
		Xpp3Dom cfg = execution.getConfiguration();
		String javaConfigFile = cfg.getChild("configFile").getValue();
		if (javaConfigFile == null
				|| "${configfile}".equals(javaConfigFile))
			javaConfigFile = "src/config/eclipse/formatter/java.xml";

		IFile cfgFile = eclipseProject.getFile(javaConfigFile);

		if (!cfgFile.exists())
			return;

		InputStream content = cfgFile.getContents();
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				content));
		String line = null;
		Map<String, String> opts = javaProject.getOptions(false);
		try {
			while ((line = reader.readLine()) != null) {
				// <setting
				// id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags"
				// value="insert" />
				if (!line.contains("<setting "))
					continue;

				int first = line.indexOf("id=\"") + 4;
				String id = line.substring(first, line.indexOf('"', first));
				first = line.indexOf("value=\"") + 7;
				String value = line.substring(first,
						line.indexOf('"', first));
				opts.put(id, value);
			}
		} catch (IOException e) {
		}

		javaProject.setOptions(opts);
	}
	// jsdtConfigFile = cfg.getChild("configJsFile").getValue();
	// src/config/eclipse/formatter/javascript.xml
}
 
开发者ID:ContaAzul,项目名称:maven-formatter-plugin-old,代码行数:54,代码来源:FormatterProjectConfigurator.java


注:本文中的org.apache.maven.plugin.MojoExecution.getConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。