-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Description
When using the NonDex tool on several projects, I faced the error below from time to time
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1.
[ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Moreover, I found that if I replaced @{argLine} with ${argLine} in pom.xml, the error was resolved
Reproduce step
- Test Environment
Apache Maven: 3.6.3
Java: 11.0.20.1
OS: Ubuntu 20.04.6 LTS
Linux kernel: 5.4.0-164-generic
mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=com.hubspot.jinjava.EagerTest#itHandlesImportInDeferredIfPossible Root cause
I think the problem is caused by the time when property replacement occurs. I found a FAQ that might related to the root cause, and I quoted and linked it below.
Maven does property replacement for
${...}
values in pom.xml before any plugin is run. So Surefire would never see the place-holders in its argLine property.
Since the Version 2.17 using an alternate syntax for these properties,
@{...}
allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly.
from https://maven.apache.org/surefire/maven-surefire-plugin/faq.html#late-property-evaluation
FYI, in the example of jinjava, the first bad commit is 0e167de44a3bab111c62b49e1b8304d09e4903b5. <argLine>@{argLine} ${basepom.test.add.opens}</argLine> has been added to the pom.xml