向maven调用程序请求添加-pl选项



我有一个小Java程序,它使用Maven Invoker以编程方式运行一些Maven命令。Maven例程基本上是:

InvocationRequest request = new DefaultInvocationRequest();
Invoker invoker = new DefaultInvoker();
request.setGoals(Arrays.asList("clean", "install"));
// module.pomFullPath(workspaceRoot) gets the module location
request.setPomFile(new File(module.pomFullPath(workspaceRoot))); 
InvocationResult result = invoker.execute(request);

这将在模块上运行mvn clean install。现在我需要运行一个添加选项的命令,提示mvn -pl !skipThis clean install

如何将-pl选项添加到程序中的request对象?提前感谢您的回答/评论

这是你的朋友:

InvocationRequest setProjects(List<String> projects)

最新更新