JSON ObjectMapper with javac "-parameters" behaves when run via maven, not via InteliJ IDEA
As far as I can see in the IntelliJ Community edition sources, IntelliJ is not doing anything with the compilerArgs
you're specifying.
In MavenProject.java, there are two places where the compilerArgs
are being read:
Element compilerArguments = compilerConfiguration.getChild("compilerArgs");if (compilerArguments != null) { for (Element element : compilerArguments.getChildren()) { String arg = element.getValue(); if ("-proc:none".equals(arg)) { return ProcMode.NONE; } if ("-proc:only".equals(arg)) { return ProcMode.ONLY; } }}
and
Element compilerArgs = compilerConfig.getChild("compilerArgs");if (compilerArgs != null) { for (Element e : compilerArgs.getChildren()) { if (!StringUtil.equals(e.getName(), "arg")) continue; String arg = e.getTextTrim(); addAnnotationProcessorOption(arg, res); }}
The first code block is only looking at the -proc:
argument, so this block can be ignored. The second one is passing the values of the arg
element (which you are specifying) to the addAnnotationProcessorOption
method.
private static void addAnnotationProcessorOption(String compilerArg, Map<String, String> optionsMap) { if (compilerArg == null || compilerArg.trim().isEmpty()) return; if (compilerArg.startsWith("-A")) { int idx = compilerArg.indexOf('=', 3); if (idx >= 0) { optionsMap.put(compilerArg.substring(2, idx), compilerArg.substring(idx + 1)); } else { optionsMap.put(compilerArg.substring(2), ""); } }}
This method is only processing arguments which start with -A
, which are used to pass options to the annotation processors. Other arguments are ignored.
Currently, the only ways to get your sources to run from within IntelliJ are to enable the flag yourself in the "Additional command line parameters" field of the compiler settings (which isn't portable), or by compiling with maven as a pre-make step in your run configuration. You probably have to file an issue with Jetbrains if you want this to be possible in IntelliJ automatically.