Maven Embedder:如何添加命令选项

时间:2016-03-30 13:43:03

标签: java maven maven-embedder

我正在使用Maven Embedder

$("body").on('mouseenter', '*', function(e) {
    e.stopPropagation();
    if (e.target.id.length)
        console.log(e.target.id + ' - in');
}).on('mouseleave', '*', function(e) {
    e.stopPropagation();
    if (e.target.id.length)
        console.log(e.target.id + ' - out');
});

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

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

中的

mvn process-resources

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

tmp/projectdir

如何做到这一点?

1 个答案:

答案 0 :(得分:0)

-Dstage=local是一个系统变量,只需将其作为参数参数设置为doMain()

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