Tom*_*Tom 5 maven-2 maven-plugin maven
我正在尝试使用 Maven 调用程序 API 以交互模式调用其他 Maven 插件,但交互模式在 InvocableRequest 上没有设置 InputStream 时失败。此时有没有办法检索控制台提示符?
InvocationRequest invocationRequest = new DefaultInvocationRequest();
invocationRequest.setPomFile("/some/pom/file/pom.xml");
// set up goals etc
invocationRequest.setInteractive(true);
// Here I need to add the input stream: eg invocationRequest.setInputStream(???);
Invoker invoker = new DefaultInvoker();
InvocationResult result = invoker.execute(invocationRequest);
Run Code Online (Sandbox Code Playgroud)
如果没有输入流,调用的目标就无法完成。
编辑[一点说明]:InvocableRequest 对象上有一个 .setInputStream 方法。如果请求是交互式的,DefaultInvoker 将检查是否已设置。
if ( request.isInteractive() ) {
if ( inputStream == null ) {
getLogger().warn("Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.");
// etc
Run Code Online (Sandbox Code Playgroud)
这表明应该可以将 InputStream 设置为合适的值,但我不确定如何访问它。
归档时间: |
|
查看次数: |
1530 次 |
最近记录: |