Hi,

Why don't you activate the profile based on maven.compiler.source property 
value? (I know that it only support exact match: this won't be flexible enough 
to support java 9 in the future, but we have time to improve things before 
java 9 is released)

Toolchain is not something that core knows about: then you're right, the 
documentation about profile activation through "jdk" should be improved to 
better describe this fact.
Or perhaps, in a future Maven version, we should not use really the jdk 
version (ie the JRE Maven runs with) for profile activation but use 
maven.compiler.source (or target) value when set


Another complementary part of solution would be to add this JEP 118 
"parameters" option support: yes, this will require plexus-compiler update 
then maven-compiler-plugin: on plexus-compiler, please don't only send a pull 
request but create an issue to document the new feature and track the 
component evolution.

Regards,

Hervé

Le jeudi 21 avril 2016 18:48:09 Steven Schlansker a écrit :
> Hi maven-dev,
> 
> I am trying to use the JEP 118 "-parameters" compile flag which bundles
> method parameter names into class metadata for access at runtime.
> 
> I would like to enable this in our corporate parent POM, which
> configures the compiler plugin.  Per documentation, I could add
> 
> <compilerArgs>
>   <arg>-parameters</arg>
> </compilerArgs>
> 
> Unfortunately, this is new in Java 1.8 -- so any project that does not
> target 1.8 cannot use this option.
> 
> Since we use toolchains to compile some 1.6 code, we would have to enable
> this argument only for 1.8 projects.  Would be a great use for a Maven
> profile, but unfortunately my understanding is profile activation only
> triggers on the *JDK used to invoke Maven*, not the *toolchain JDK* -- in
> our case the former will be 1.8, the latter 1.6, and then you end up
> with unknown compiler arguments.
> 
> This sucks!
> 
> Aside from griping about how inflexible profiles are, and how difficult it
> is to manage compiler arguments in a heterogeneous environment, I think it
> would be useful to introduce a CompilerConfiguration boolean for parameter
> names.
> 
> The pull request would likely look similar to:
> https://github.com/codehaus-plexus/plexus-compiler/pull/14
> 
> It would add the "-parameters" flag only if the *toolchain* JDK supports it,
> otherwise it would be a noop (and maybe a warning?)
> 
> Then, there would be a separate patch to maven-compiler-plugin to use the
> new plexus-compiler and expose the argument to the POM configuration.
> 
> Is this a good approach?  Would such a PR get merged?  Have I missed
> anything obvious?
> 
> Thanks,
> Steven Schlansker


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to