As the title says I am unable to pass command line parameters to the java compiler using maven, I am using the maven-compiler-plugin to do it, and accordingly to this (specifically for the compilerArgs option of the pluging) I am using the "latest way" to speficy the arguments passed to the compiler. Well enough talk, more code, this is my maven configuration for the plug-in and I am not sure what am I doing wrong:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
I am following the instructions for the usage of the tool which says that <fork>
have to be set to true, and I do not know what am I missing... a little bit of help please?
May or may not be helpful to mention that: I need the parameters
argument as specified here because I want to get the name of the arguments in my methods in runtime using reflection; I use the -X argument when calling maven to see the debug and I shows me the "fork" call that it does and I cannot se ANYWHERE the arguments I am passing (maybe I need to enable the plug-in; but I think In this case is automatically enabled since it is not part of any profile, I am not a maven expert so please correct me if I am wrong).
EDIT: I have tried in several ways with and without the dash I have even tried the "old way" to do it:
<compilerArguments>
<parameters />
</compilerArguments>
And:
<compilerArgument>-parameters</compilerArgument>
PFFF Guys forget it, and sorry for bothering you :(
My mistake: I created the code first previous to modify my pom file, and run it USING MAVEN to check that is was actually working, after that I modified my pom to include the -parameters
flag to print the name of my my parameters in my method to see that it was actually working. The code had already been compiled once WITHOUT the flag being set and THE CODE WAS NEVER MODIFIED AFTER therefor maven "said" 'well there are no changes on this file, I do not need to re-compile it, I'll just use the one already compiled before' (which usually is a good thing, it reduces compilation time) but not in this case because the -parameters flag compiles the code in a way that is a "fat class" (or at least heavier since it includes the name of the parameters) but maven did not know about that. T.T
SOLUTION execute a mvn clean or delete the compiled classes or deleate the /target folder (in summary DO WHAT EVER IS NECESSARY TO ENSURE THAT THE FILES ARE COMPILED AGAIN)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With