如何解决Maven Invoker API警告:Maven将以交互模式执行,但没有配置输入流 [英] How to solve Maven Invoker API warning: Maven will be executed in interactive mode, but no input stream has been configured

查看:311
本文介绍了如何解决Maven Invoker API警告:Maven将以交互模式执行,但没有配置输入流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 MavenInvokerAPI 调用 Maven 运行的插件.一切正常,但我的 Maven 控制台输出中确实有此警告.

I have a plugin which invokes Maven runs using MavenInvokerAPI. Everything is working fine, but I do have this warning in my Maven console output.

[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.

我在构建过程中不需要交互,基于setInputStream()的Javadoc,我将inputStream设置为null,但我再次收到此警告:

I do not need interaction in my build process, and based on Javadoc of setInputStream(), I set my inputStream to null, but again I have this warning:

   /**
     * Sets the input stream used to provide input for the invoked Maven build. This is in particular useful when
     * invoking Maven in interactive mode.
     * 
     * @param inputStream The input stream used to provide input for the invoked Maven build, may be <code>null</code>
     *            if not required.
     * @return This invoker instance.
     */
    Invoker setInputStream( InputStream inputStream );

我该如何解决这个问题?或者可能隐藏控制台的警告?

How can I solve this? Or maybe hide the warning from console?

推荐答案

只需设置一个空的 InputStream

Just set an empty InputStream

InvocationRequest invocationRequest = new DefaultInvocationRequest();
invocationRequest.setInputStream(InputStream.nullInputStream());
...

这篇关于如何解决Maven Invoker API警告:Maven将以交互模式执行,但没有配置输入流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆