0

我正在使用Maven Embedder如下:

MavenCli cli = new MavenCli();
int result = cli.doMain(new String[] { "process-resources" }, "tmp/projectdir", System.out, System.err);

这有效,相当于运行命令行命令

mvn process-resources

在目录中

tmp/projectdir

但是,我需要为 Maven 指定一个选项,以便 Maven Embedder 执行与命令行命令等效的操作

mvn -Dstage=local process-resources

如何才能做到这一点?

4

1 回答 1

0

-Dstage=local is a system variable that is set by just giving it as the argument parameter to doMain():

MavenCli cli = new MavenCli();
int result = cli.doMain(new String[] { "-Dstage=local", "process-resources" }, "tmp/projectdir", System.out, System.err);
于 2016-03-30T13:45:29.297 回答