'How to increase the error limit of 100 errors on IntelliJ IDEA?
I have an IntelliJ IDEA project but the compilation stops when it does encounter more than 100 errors and I would like to increase the limit in order to figure it out how much I do have to "refactor" the ancient code.
Solution 1:[1]
The 100 error limit you are seeing is not a limit of IntelliJ IDEA, per se, but is a default for the javac compiler that is being used to compile an application. After IDEA is using. the default number of errors, after is the default for the standard Sun/Oracle javaccompiler, but can be modified by passing an argument to the compiler; as can the maximum number of warnings, which also defaults to 100.
The online documentation for javac (e.g., the Java SE version 7 page at 'javac - Java programming language compiler'†) gives these arguments (in the section "Options", under the sub-heading "Non-Standard Options") as follows:
-Xmaxerrs number
Set the maximum number of errors to print.
-Xmaxwarns number
Set the maximum number of warnings to print.
When using javac in IntelliJ IDEA, these (and other) compiler arguments can be added by navigating to the settings for the project (e.g. F?ile > Set?tings or Ctrl+Alt+S); then, under the Project Settings heading, expand the ? Compiler section, select Java Compiler and enter the desired setting(s) into the text box following Additional command line parameters:. (e.g. to increase the limits to 123 errors and 456 warnings, enter -Xmaxerrs 123 -Xmaxwarns 456 into the textbox.)
† from http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html, retrieved 2014-07-31, Archived by WebCite® at http://www.webcitation.org/6RTlsAI8T
‡ this process was vetted on version 13, by shelleybutterfly, and version 12 by Nicolas Guillaume, but the process is likely very similar, if not the same, for other versions.
Solution 2:[2]
If you're using Gradle (probably because you're using Android), change the allprojects bit of your Project build.gradle (not the Module one) as follows:
allprojects {
repositories {
jcenter()
}
// Allow 400 errors.
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "400"
}
}
}
Solution 3:[3]
2022 UPDATE
The question is old but still valid when wanting to use current IDE technology on legacy code. For a maven build in intellij, Nicolas Guillaume's answer will not work - those settings are rightly overridden by maven. However, this configuration will yield the same result:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.0</version>
<configuration>
<fork>true</fork>
<compilerVersion>1.5</compilerVersion>
<executable>C:\Java\jdk-1.5.0_22\bin\javac.exe</executable>
<source>1.5</source>
<target>1.5</target>
<compilerArgs>
<arg>-Xmaxerrs</arg>
<arg>1000</arg>
<arg>-Xmaxwarns</arg>
<arg>2000</arg>
</compilerArgs>
</configuration>
</plugin>
Some sources (even on SO) state that the correct option for Java5 is -Xmaxerrors, which is incorrect as reported in this bug. And that option didn't exist in 1.4 and earlier versions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cb4 |
| Solution 2 | Timmmm |
| Solution 3 | cb4 |
