I have an application that runs just fine when running this from the command prompt :
java -jar --illegal-access=permit target/Something.jar
However, configuring my spring boot maven plugin in my pom.xml
as such gives me the same error as if I ran my cmd without the illegal-access=permit
part, telling me it is being ignored :
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.something.PreMain</mainClass>
<jvmArguments>
--illegal-access=permit
</jvmArguments>
</configuration>
</plugin>
What am I doing wrong? This app worked perfectly in java 14 and I'm in the process of upgrading to java 16. Everything still works perfectly except intelliJ not being able to launch it in debug mode due to the missing illegal-access=permit
JVM argument.
If you're trying to run the application in IntelliJ, you don't need to pass anything into Maven. In IntelliJ, open the run configuration for your app and under Environment->VM options add --illegal-access=permit. See the attached image, Main class would be your fully qualified location of your @SpringBootApplication
class, e.g. com.something.MySpringBootApplication
When you start your app in debug mode in IntelliJ, you'll see something like
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:52737,suspend=y,server=n --illegal-access=permit -XX:TieredStopAtLevel=1...
, notice the argument getting passed to your app.