Closed poikilotherm closed 2 years ago
Thanks for the kudos.
Not tested, but you can use MAVEN_OPTS
environment variable to o set up appropriate Java options to remove the warning. I see no other way around it
Hi @poikilotherm,
Were you able to test the suggestion made by Lenny?
Nope, not yet.
That warning isn't very specific about where that illegal access happens... But maybe there is a way to fix the code?
From the code there are multiple places that access to an unmodifiable list might happen. 🤔
There is no way to “fix” this in the code. The only way to remove the warning is to do what’s suggested above
The stack overflow link has the exact suggestion on how to fix this
Thx @lprimak, I did mean no offense.
After digging a bit more into this, at least I can show some more debug output:
I see why there is no way around this.
As this happened during a Maven Failsafe test, MAVEN_OPTS cannot be used. You need to either any JVM args via argLine
in plugin config or via user property:
mvn -DargLine="--illegal-access=debug" -Parq-payara-managed verify
(This could also be provided within .mvn/maven.config
as of Maven 3.3+)
To finally resolve the issue you'd use:
mvn -DargLine="--add-opens=java.base/java.util=ALL-UNNAMED" -Parq-payara-managed verify
(Or add this to the plugin config / .mvn/maven.config
)
No offense taken. You can add the same argLine to MAVEN_OPTS no? That’s what I was hinting att
Aye, MAVEN_OPTS="-DargLine=--illegal-access=debug --add-opens=java.base/java.util=ALL-UNNAMED" mvn -Parq-payara-managed verify
does the trick, too.
Also I like more the beauty of a short CLI call and providing it via config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<argLine>--illegal-access=debug --add-opens=java.base/java.util=ALL-UNNAMED</argLine>
<systemPropertyVariables>
<payara.home>${project.build.directory}/payara5</payara.home>
</systemPropertyVariables>
</configuration>
</plugin>
Description
Using this handy extension prints a warning about an
illegal reflective access operation has occurred
.Expected Outcome
No warning.
Current Outcome
Sample Project (Optional)
mvn -Parq-payara-managed verify
to execute integration test using Arquillian Payara Managed.:mega: Shoutout and kudos to @lprimak for the handy extension :pray:
Environment