0
Follow
2
View

How can I specify --add-opens from a project level and make sure it is taken into account whatever the means to run my app?

dicongyan 注册会员
2023-01-25 00:40

You can use the option to add the JDK parameters in the maven plugins like surefire plugin.

       
            org.apache.maven.plugins
            maven-surefire-plugin
            
                    
                        --add-opens java.base/java.time=ALL-UNNAMED
                        ${surefireArgLine}
                    
            
       

I have tried the above approach for IntelliJ IDE and Java 17 (Temurin-17.0.1). It works fine on running via java -jar command, as well as on running the app via IDE.

If you have multiple such JVM options to add, try keeping those assigned to a property and use that property here in the argLine.

dqx82308064 注册会员
2023-01-25 00:40

Follow steps:

--add-opens java.base/java.lang=ALL-UNNAMED

About the Author

Question Info

Publish Time
2023-01-25 00:40
Update Time
2023-01-25 00:40