0

I am building a java project using maven. I have appointed the compiler source and target to 11 in the pom.xml.

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

However, when I execute mvn package, I got an error message indicating class AccessControlException in java.security is deprecated and will be removed.

I'm really confused, since the AccessControlException class is deprecated after JDK 17 while I am using JDK 11. Can anyone tell me what's wrong?

I've tried to compile my project both in IDEA and using command line, but getting this error all the time. When using IDEA, I've set the SDK and the language level of the project and all its modules to 11. I also set the maven runner JRE to use the prokect JDK.

Dan Wang
  • 1
  • 1
  • 1
    What JDK does it show when you run `mvn --version` in the command? – LJ replica Mar 07 '23 at 03:49
  • Perhaps you need to check the setting for the compiler plugin as well, see https://stackoverflow.com/questions/38882080/specifying-java-version-in-maven-differences-between-properties-and-compiler-p – Hulk Mar 07 '23 at 04:24
  • @LJreplica, It's JDK 17. I realized this may be the reason for compilation error using the command line. So I changed it to JDK 11 and the compilation succeeded. However, I still wonder why compile using IDEA failed given that I have appoint all possible configuration of JDK to 11. – Dan Wang Mar 07 '23 at 07:39
  • Check `Settings | Build, Execution, Deployment | Build Tools | Maven | Runner`, `File | Project Structure | Modules | module_name | Dependencies | Module SDK` any JDK 17 there. – LJ replica Mar 07 '23 at 09:43

0 Answers0