You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Maarten Mulders (Jira)" <ji...@apache.org> on 2021/11/19 10:23:00 UTC

[jira] [Created] (MNG-7340) --fail-on-severity/-fos eats remaining CLI arguments

Maarten Mulders created MNG-7340:
------------------------------------

             Summary: --fail-on-severity/-fos eats remaining CLI arguments
                 Key: MNG-7340
                 URL: https://issues.apache.org/jira/browse/MNG-7340
             Project: Maven
          Issue Type: Bug
          Components: Command Line
            Reporter: Maarten Mulders


When you invoke Maven with {{mvn -fos WARN package}} on any project, you would expect the build to run until the package phase; when a warning would be logged, the build should fail.

However, the build fails with a different reason:

{quote}[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy, wrapper. -> [Help 1]{quote}

If you change the order of the invocation to {{{}mvn package -fos WARN{}}}, it works as expected:

{quote}[INFO] Enabled to break the build on log level WARN.
[INFO] Scanning for projects...
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Reactor Build Order:

...

[ERROR] Build failed due to log statements with a higher severity than allowed. Fix the logged issues or remove flag --fail-on-severity (-fos).
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the '-e' switch
[ERROR] Re-run Maven using the '-X' switch to enable verbose output{quote}

This is because the Commons CLI "option" for {{--fail-on-severity}} accepts multiple arguments, where it should accept only one.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)