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


Java Invoker.setMavenHome方法代码示例

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


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

示例1: invokeMaven

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
private void invokeMaven(File pomFile, String goal) throws CommandLineException, MavenInvocationException
{
    InvocationRequest request = new DefaultInvocationRequest();
    request.setPomFile(pomFile);
    request.setGoals(Collections.singletonList(goal));
    request.setJavaHome(javaHome);
    request.setShowErrors(true);

    Invoker invoker = new DefaultInvoker();
    invoker.setMavenHome(mavenHome);

    InvocationResult result = invoker.execute(request);

    // check status
    CommandLineException executionException = result.getExecutionException();
    if (executionException != null)
    {
        throw executionException;
    }

    assertEquals(0, result.getExitCode());
}
 
开发者ID:mytaxi,项目名称:phrase-maven-plugin,代码行数:23,代码来源:IntegrationTest.java

示例2: runMaven

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
public List<String> runMaven(final File workingDir, final String... arguments) throws IOException {
	final InvocationRequest request = createRequest();

	request.setGoals(asList(arguments));
	request.setBaseDirectory(workingDir);

	final Invoker invoker = new DefaultInvoker();
	invoker.setMavenHome(mvnHome);
	final CollectingLogOutputStream logOutput = new CollectingLogOutputStream(false);
	invoker.setOutputHandler(new PrintStreamHandler(new PrintStream(logOutput), true));

	int exitCode;
	try {
		final InvocationResult result = invoker.execute(request);
		exitCode = result.getExitCode();
	} catch (final Exception e) {
		throw new MavenExecutionException(1, logOutput.getLines());
	}
	final List<String> output = logOutput.getLines();

	if (exitCode != 0) {
		throw new MavenExecutionException(exitCode, output);
	}

	return output;
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:27,代码来源:MvnRunner.java

示例3: main

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
	InvocationRequest request = new DefaultInvocationRequest();
	request.setPomFile(new File("pom.xml"));
	if (args.length > 0) {
		if (args[0] != null && args[1] != null) {
			Properties projectProperties = new Properties();
			projectProperties.setProperty("deviceOS", args[0]);
			projectProperties.setProperty("appPath", args[1]);
			projectProperties.setProperty("osVersion", args[2]);
			projectProperties.setProperty("deviceName", args[3]);
			projectProperties.setProperty("udid", args[4]);
			request.setProperties(projectProperties);
		}
	}

	request.setGoals(Collections.singletonList("test"));
	Invoker invoker = new DefaultInvoker();
	invoker.setMavenHome(new File(System.getenv("M2_HOME")));
	try {
		invoker.execute(request);
	} catch (MavenInvocationException e) {
		e.printStackTrace();
	}
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:25,代码来源:MavenRun.java

示例4: execute

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
public static void execute(File dir, List<String> commands, Properties props, boolean logToStdOut) throws MavenInvocationException {
	InvocationRequest request = new DefaultInvocationRequest();
	request.setBaseDirectory(dir);
	request.setGoals(commands);
	if (props!=null) {
		request.setProperties(props);
	}
	Invoker invoker = new DefaultInvoker();
	invoker.setMavenHome(mavenHome);
	
	if (!logToStdOut) {
		request.setOutputHandler(emptyHandler);
	}
	
	invoker.execute(request);
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:17,代码来源:MavenUtil.java

示例5: getClassPath

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
public static String getClassPath(File projectDir) {
	
	InvocationRequest request = new DefaultInvocationRequest();
	request.setBaseDirectory(projectDir);
	request.setGoals(Collections.singletonList("dependency:build-classpath"));
	Invoker invoker = new DefaultInvoker();
	invoker.setMavenHome(mavenHome);

	ClassPathListener cpl = new ClassPathListener();
	invoker.setOutputHandler(cpl);

	try {
		invoker.execute(request);
	} catch (MavenInvocationException e) {
		e.printStackTrace();
	}

	return cpl.classPath;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:20,代码来源:MavenUtil.java

示例6: setupInvoker

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
private Invoker setupInvoker() {
  Invoker invoker = new DefaultInvoker();
  File calculatedMavenHome = ReleaseUtil.getMavenHome(Optional.fromNullable(this.mavenHome));
  if (calculatedMavenHome != null) {
    this.log.debug("\tUsing maven home: " + calculatedMavenHome.getAbsolutePath());
    invoker.setMavenHome(calculatedMavenHome);
  }
  return invoker;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:10,代码来源:BuildProject.java

示例7: runGoals

import org.apache.maven.shared.invoker.Invoker; //导入方法依赖的package包/类
private int runGoals(String pathToRootOfProject, String... goals) {
	InvocationRequest request = new DefaultInvocationRequest();
	request.setGoals(Arrays.asList(goals));
	request.setPomFile(new File(pathToRootOfProject + FILE_SEPARATOR + POM_FILE));
	request.setJavaHome(new File(System.getProperty("java.home")));

	Properties properties = new Properties();
	properties.setProperty("enforcer.skip", "true");
	properties.setProperty("checkstyle.skip", "true");
	properties.setProperty("cobertura.skip", "true");
	properties.setProperty("skipITs", "true");
	properties.setProperty("rat.skip", "true");
	properties.setProperty("license.skip", "true");
	properties.setProperty("findbugs.skip", "true");
	properties.setProperty("gpg.skip", "true");
	request.setProperties(properties);

	Invoker invoker = new DefaultInvoker();
	invoker.setMavenHome(new File(this.mavenHome));
	LOGGER.info(String.format("run maven %s", Arrays.stream(goals).collect(Collectors.joining(" "))));
	if (Main.verbose) {
		invoker.setOutputHandler(System.out::println);
		invoker.setErrorHandler(System.err::println);
	} else {
		invoker.setOutputHandler(null);
		invoker.setErrorHandler(null);
	}
	try {
		return invoker.execute(request).getExitCode();
	} catch (MavenInvocationException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:34,代码来源:MavenAutomaticBuilder.java


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