public static int doMain( String[] args, ClassWorld classWorld ) { MavenCli cli = new MavenCli(); return cli.doMain( new CliRequest( args, classWorld ) ); }
public static int main( String[] args, ClassWorld classWorld ) { MavenCli cli = new MavenCli(); MessageUtils.systemInstall(); MessageUtils.registerShutdownHook(); int result = cli.doMain( new CliRequest( args, classWorld ) ); MessageUtils.systemUninstall(); return result; }
MavenCli cli = new MavenCli(); cli.doMain(new String[]{"clean", "install"}, "project_dir", System.out, System.out);
System.setProperty("user.home", "C:\\my"); // ~/.m2/repository lives here MavenCli cli = new MavenCli(); // THIS IS IMPORTANT AS WELL !!! int result = cli.doMain( new String[]{"-DincludeScope=runtime", "dependency:copy-dependencies", "clean", "validate"}, projectPath, System.out, System.out);
MavenCli cli = new MavenCli(); int result = cli.doMain(new String[]{"compile"}, "workspace/MiscMaven", System.out, System.out); System.out.println("result: " + result);
MavenCli cli = new MavenCli(); int result = cli.doMain(new String[] { "-Dstage=local", "process-resources" }, "tmp/projectdir", System.out, System.err);
MavenCli cli = new MavenCli(); cli.doMain(new String[]{"clean", "package"}, "project_dir", System.out, System.out);
public static int doMain( String[] args, ClassWorld classWorld ) { MavenCli cli = new MavenCli(); return cli.doMain( new CliRequest( args, classWorld ) ); }
/** @noinspection ConfusingMainMethod */ public static int main( String[] args, ClassWorld classWorld ) { MavenCli cli = new MavenCli(); return cli.doMain( new CliRequest( args, classWorld ) ); }
public static int doMain( String[] args, ClassWorld classWorld ) { MavenCli cli = new MavenCli(); return cli.doMain( new CliRequest( args, classWorld ) ); }
System.setErr(err); CliRequest cliRequest = createCliRequest(params, getFaceted().getRoot().getFullyQualifiedName()); int returnCode = new MavenCli().doMain(cliRequest); return returnCode == 0;
public static int main( String[] args, ClassWorld classWorld ) { MavenCli cli = new MavenCli(); MessageUtils.systemInstall(); MessageUtils.registerShutdownHook(); int result = cli.doMain( new CliRequest( args, classWorld ) ); MessageUtils.systemUninstall(); return result; }
protected static void buildAndDeployMavenProject(String basedir) { // @formatter:off // We need to backup (and later restore) the current class loader, // because the Maven/Plexus does some classloader magic // which then results in CNFE in RestEasy client // First run the Maven build which will create the kjar. // The kjar is then either installed or deployed to local and remote repo // @formatter:on logger.debug("Building and deploying Maven project from basedir '{}'.", basedir); ClassLoader classLoaderBak = Thread.currentThread().getContextClassLoader(); MavenCli cli = new MavenCli(); String[] mvnArgs; if (TestConfig.isLocalServer()) { // just install into local repository when running the local server. Deploying to remote repo will fail // if the repo does not exist. mvnArgs = new String[]{"-B", "clean", "install"}; } else { mvnArgs = new String[]{"-B", "clean", "deploy"}; } int mvnRunResult = cli.doMain(mvnArgs, basedir, System.out, System.out); if (mvnRunResult != 0) { throw new RuntimeException("Error while building Maven project from basedir " + basedir + ". Return code=" + mvnRunResult); } Thread.currentThread().setContextClassLoader(classLoaderBak); logger.debug("Maven project successfully built and deployed!"); }
@Override public Object execute(@Nonnull final CommandContext context) throws Exception { Variables variables = context.getVariables(); CliRequestBuilder request = new CliRequestBuilder(); request.setArguments(strings(context.getArguments())); File baseDir = variables.require(SHELL_USER_DIR, File.class); request.setWorkingDirectory(baseDir); File projectDir = variables.get(MavenCli.MULTIMODULE_PROJECT_DIRECTORY, File.class, null); if (projectDir == null) { projectDir = findRootProjectDir(baseDir); } request.setProjectDirectory(projectDir); // a few parts of Maven expect "maven.home" system-property to be set File shellHome = variables.require(SHELL_HOME, File.class); System.setProperty("maven.home", shellHome.getAbsolutePath()); MavenCli cli = new MavenCli(classWorld.get()); return cli.doMain(request.build()); }