当编译 Mybatis-Parent出现
mvn clean install -Dmaven.test.skip
在编译Mybatis-Parent
源码时,出现如下报错:
[INFO]
[INFO] ---------------------< org.mybatis:mybatis-parent >---------------------
[INFO] Building mybatis-parent 37-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.1.0:enforce (enforce-java) @ mybatis-parent ---
[INFO] Adding ignore: module-info
[ERROR] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 1.8 is not in the allowed range 11,17,18,19,20.
然后我改成了11, 结果还是报错,而且报错很奇怪。11居然不在 11,17,18,19,20范围内:
[INFO]
[INFO] ---------------------< org.mybatis:mybatis-parent >---------------------
[INFO] Building mybatis-parent 37-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.1.0:enforce (enforce-java) @ mybatis-parent ---
[INFO] Adding ignore: module-info
[ERROR] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 11 is not in the allowed range 11,17,18,19,20.
查了下 StackOverFlow, 感觉描述的是我使用的JDK版本为11.x肯定是大于11的,所以将pom.xml文件中的范围改为:
<allowed.build.jdks>[11,12)</allowed.build.jdks>
再次编译打包成功。
当编译mybatis3时出现
再编译mybatis3时,仍然报上面的错误。这个很容易推测出来,肯定是引入parent的时候没有引入我们刚打包的。查看果然如此:
<groupId>org.mybatis</groupId>
<artifactId>mybatis-parent</artifactId>
<version>37-SNAPSHOT</version>
<packaging>pom</packaging>
mybatis-parent的pom.xml
<parent>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-parent</artifactId>
<version>36</version>
<relativePath />
</parent>
mybatis3的pom.xml
所以将mybatis3的pom.xml中parent版本改为37-SNAPSHOT
即可。