我想阻止maven显示INFO消息,我想只看到警告和错误(如果有的话).
我怎样才能实现这一点,最好是通过更改调用maven的命令行来实现?
由于我使用的配置,我得到了很多这些:
[WARNING] 'dependencies.dependency.systemPath' for local-deps:[...] should not point at files within the project directory, ${basedir}/[...] will be unresolvable by dependent projects [...]
Run Code Online (Sandbox Code Playgroud)
由于这是应用程序当前的设置方式,我无法修复它们;但是它们使控制台混乱,那么有没有办法禁用它们?mvn --quiet不是一个选项,因为它删除了太多消息。
我正在尝试使用maven插件测试工具来测试我的maven插件.我能在这个问题上找到的唯一文件是相当陈旧的,我发现类似的线程有相同的错误,但没有解决方案,至少没有解决问题的方法.在尝试运行lookupMojo方法时,错误可以归结为抛出NoSuchElementException.
有没有其他人遇到此问题或类似问题,您是如何解决的?如果您需要更多信息,请告诉我,我会发布更新.
插件类
@Mojo(name = "my_plugin", defaultPhase = LifecyclePhase.CLEAN, threadSafe = true)
public class MyPlugin extends AbstractMojo
{
private static final Logger logger = LoggerFactory.getLogger(MyPlugin.class);
@Parameter private String configFileLocation;
public void execute() throws MojoExecutionException, MojoFailureException
{
logger.info("The config file location is: {}", configFileLocation);
saveSystemProperties(new File(configFileLocation));
}
private void saveSystemProperties(final File file)
{
logger.info("Attempting to save system properties");
try(FileOutputStream fr = new FileOutputStream(file))
{
System.getProperties().store(fr, "Properties");
logger.info("Properties successfully saved. Closing File Output Stream …Run Code Online (Sandbox Code Playgroud)