Continue maven build after Error Prone error

992 views
Skip to first unread message

Chris Brown

unread,
Nov 1, 2017, 8:55:52 AM11/1/17
to error-prone-discuss
Hi All,

I'm using maven analyze projects with Error Prone but noticed that the build fails after one error is found and doesn't continue analyzing all the files. For example, I have a test project with multiple files all containing the exact same error (details below) but the build quits after just finding one. I have also tried mvn compile options (-fae,--fail-at-end and -fn,--fail-never) but still running into the same issue where it quits after one file. Is this expected and/or does anyone know how to use Maven to analyze every file in the project even after an EP error?



Output: $ mvn -q compile
/home/.../src/main/java/ShortSet.java:8: error: [CollectionIncompatibleType] Argument 'i - 1' should not be passed to this method; its type int is not compatible with its collection's type argument Short
      s.remove(i - 1);
              ^
    (see http://errorprone.info/bugpattern/CollectionIncompatibleType)
1 error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project tool-recommender-bot-test: Compilation failure -> [Help 1]
[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 full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

* The project has three files- ShortSet.java, LongSet.java, and ShortList.java all with the exact same error from one of the examples on the website.
EX)
import java.util.*;

public class ShortSet {
  public static void main (String[] args) {
    Set<Short> s = new HashSet<Short>();
    for (short i = 0; i < 100; i++) {
      s.add(i);
      s.remove(i - 1);
    }
    System.out.println(s.size());
  }
}

Nicholas Glorioso

unread,
Nov 2, 2017, 7:47:06 PM11/2/17
to error-pro...@googlegroups.com
One route you can use is adding -XepAllErrorsAsWarnings as a <compilerArg> to the compilation and enable warnings. Then you can see all the output, fix them, and remove the argument to validate that you have them all.

--
Googlers: This an external list. Please be careful when posting.
---
You received this message because you are subscribed to the Google Groups "error-prone-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to error-prone-dis...@googlegroups.com.
Visit this group at https://groups.google.com/group/error-prone-discuss.
To view this discussion on the web visit https://groups.google.com/d/msgid/error-prone-discuss/db45fe67-86ee-4c9b-b2b4-e81677d48beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages