我有一个使用MavenInvokerAPI调用maven运行的插件。一切正常,但是我在maven领事输出中确实有此警告。
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
我在构建过程中不需要交互,并且基于setInputStream的java doc,我将我的inputStream设置为null,但是再次出现此警告。
/**
* 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 );
我该如何解决?还是在领事中隐藏警告?
只需设置一个空的InputStream
InvocationRequest invocationRequest = new DefaultInvocationRequest();
invocationRequest.setInputStream(InputStream.nullInputStream());
...