[ 
https://issues.apache.org/jira/browse/MNG-8598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17932182#comment-17932182
 ] 

Tamas Cservenak commented on MNG-8598:
--------------------------------------

You are right, I was wrong here.

Maven 4 got a feature that a) interpolates command line and b) exposes new 
properties {{session.rootDirectory}} (and top), and this was "lightly" 
backported to Maven 3.9.2 as part of MNG-7774. So this I wrote above would work 
IF the expression would end up on Maven command line (it would be 
interpolated). Again, as Maven 3.9.2 got "light backport", the expression, 
while it looks like "maven object property", is in fact not, is "just an 
expression".

Still, as jvm.config ends up of Java (but not on Maven) command line, it will 
be NOT interpolated. So this is where I was wrong.

https://github.com/apache/maven/blob/maven-3.9.x/apache-maven/src/bin/mvn#L200

> Support for evaluated jvm.config files to improve lombok+ecj support
> --------------------------------------------------------------------
>
>                 Key: MNG-8598
>                 URL: https://issues.apache.org/jira/browse/MNG-8598
>             Project: Maven
>          Issue Type: Improvement
>          Components: Command Line
>    Affects Versions: 3.9.6
>            Reporter: Marc Guillemot
>            Priority: Major
>
> We use lombok together with the ecj compiler in a large project. For that, we 
> use {{lombok.jar}} as java agent for maven (corresponds to the official 
> lombok documentation: 
> [https://projectlombok.org/setup/ecj)|https://projectlombok.org/setup/ecj),].
> At the root level of the project, this is quite easy
> {{.mvn/jvm.config:}}
> {code:java}
> -javaagent:lombok.jar=ECJ
> {code}
> We want to be able to call mvn in any module of the project, which means that 
> each submodule needs to have its own {{.mvn/jvm.config}} with the relative 
> path to the {{lombok.jar}} file, otherwise maven can't start because the 
> agent is not found:
>  - at depth 1: {{-javaagent:../lombok.jar=ECJ}}
>  - at depth 2: {{-javaagent:../../lombok.jar=ECJ}}
>  - at depth 3: {{-javaagent:../../../lombok.jar=ECJ}}
>  - ...
> This is naturally very annoying and error prone (new modules need to have 
> their {{.mvn/jvm.config}} and relative paths have to be adapted when moving 
> modules).
>  
> It seems to me that maven doesn't provide currently any better way to achieve 
> that (I hope, I'm wrong) but that this could be achieved improving the 
> {{{}mvn.bat{}}}/{{{}mvn{}}} scripts with:
>  * interpolation of contained variables ({{{}MAVEN_PROJECTBASEDIR{}}} would 
> be the interesting one)
>  * support for two different {{jvm.config}} files allowing bat/sh specific 
> references for variables.
> In our case it would be a "sh.jvm.config" with 
> {{-javaagent:$MAVEN_PROJECTBASEDIR/lombok.jar=ECJ}} and a "bat.jvm.config" 
> with {{{}-javaagent:%MAVEN_PROJECTBASEDIR%\lombok.jar=ECJ{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to