Marc Guillemot opened MNG-8598 and commented
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),).
At the root level of the project, this is quite easy
.mvn/jvm.config:
-javaagent:lombok.jar=ECJ
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{}.
Affects: 3.9.6
Remote Links:
Marc Guillemot opened MNG-8598 and commented
We use lombok together with the ecj compiler in a large project. For that, we use
lombok.jaras java agent for maven (corresponds to the official lombok documentation: https://projectlombok.org/setup/ecj),).At the root level of the project, this is quite easy
.mvn/jvm.config: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.configwith the relative path to thelombok.jarfile, otherwise maven can't start because the agent is not found:-javaagent:../lombok.jar=ECJ-javaagent:../../lombok.jar=ECJ-javaagent:../../../lombok.jar=ECJThis is naturally very annoying and error prone (new modules need to have their
.mvn/jvm.configand 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:{}MAVEN_PROJECTBASEDIR{} would be the interesting one)jvm.configfiles allowing bat/sh specific references for variables.In our case it would be a "sh.jvm.config" with
-javaagent:$MAVEN_PROJECTBASEDIR/lombok.jar=ECJand a "bat.jvm.config" with{}-javaagent:%MAVEN_PROJECTBASEDIR%\lombok.jar=ECJ{}.Affects: 3.9.6
Remote Links: