How to solve Maven Invoker API warning: Maven will be executed in interactive mode, but no input stream has been configured

点点圈 提交于 2021-02-08 16:34:34

问题


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.

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?


回答1:


Just set an empty InputStream

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


来源:https://stackoverflow.com/questions/60637697/how-to-solve-maven-invoker-api-warning-maven-will-be-executed-in-interactive-mo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!