在 activejdbc 项目编译的时候提示错误:
[ERROR] Failed to execute goal org.javalite:activejdbc-instrumentation:2.0:instrument (default) on project activejdbc: Failed to add output directory to classpath: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @9175580c -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :activejdbc
上面的错误是什么问题?
错误原因和解决
出现上面的错误原因是 activejdbc 版本和 JDK 的版本不一致导致的。
activejdbc 我们还用在 <activejdbc.version>2.0</activejdbc.version>
版本,但 JDK 已经是 17 的版本了。
为了解决这个问题,activejdbc 的版本需要修改为: 3.4-j11
这个版本才能用 JDK 17 进行编译。