Javac provides the following nonstandard option (from "javac -X" command line help):
-Xplugin:"name args" Name and optional arguments for a plug-in to be run
However, Maven does not handle that format. For example, the following does not work:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Xplugin:"Manifold static"</arg>
</compilerArgs>
</configuration>
</plugin>
I've tried several different variations and tried replacing the space with '=', still no bueno. Is there a workaround?
Note I am using the Manifold javac plugin with Java 8. Reproducing is simple.. create a pom with a dependency on the manifold-all jar:
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-all</artifactId>
<version>0.9-alpha</version>
</dependency>
You don't really need any source, this is just to demonstrate that Maven will not accept the -Xplugin:"Manifold static"
javac argument.
Also note Java 9 appears to have changed the format of -Xplugin
to no longer require quotes. See the Java 9 docs on this.
In light of this discussion: MCOMPILER-178 and this patch: pull request, and since a space doesn't seem to be a character allowed in XML-names, I would suspect that you have to just drop all the double-quotes, and keep all the spaces.
This here:
is string concatenation in
bash
(or whatever shell your are using). It stores the string "foobarbaz" in variablemyOption
. If you use double quotes in an option inbash
, then it simply means: "bash, please treat the entire thing between the quotes as a single argument, don't split it into an array of string arguments". For example, if you run the following bash script:with these arguments:
you will get this output:
The
-World:blah blah blah
part is a single string, the quotes are not preserved.Maven is not bash. POM is an XML file, it has tags, some of the tags are filled with text. XML doesn't care about bash's syntax for string concatenation or argument-parsing. If I understood the above discussion correctly, they passed the content of the xml-tags directly to the compiler, without any modifications.
Therefore, my best guess would be to just drop the double quotes:
If this doesn't help, then I misunderstood the discussion linked above entirely, or maybe you are using a maven version that works differently.