我能够在Tomcat8.5.x和Tomcat9(运行Java8)上部署Grails3Server。我似乎不能让它在Tomcat10上工作,我想知道这是否可能。有没有包含Grails、Tomcat和Java的版本矩阵,有人可以给我指出来?
发布于 2021-09-28 23:57:49
对于您的问题,没有简单的答案。
Grails与Tomcat的兼容性取决于Tomcat和Java的兼容性,而Grails与Java的兼容性又取决于Groovy与Java的兼容性以及Spring/SpringBoot与Java的兼容性。
不幸的是,在Grails official documentation中,关于这个问题的细节往往很少,如果有的话。
所以让我们开始拼凑吧……
Grails - Groovy
为了找出哪个版本的Groovy附带哪个版本的Grails,有时您必须检查Grails包,因为这些信息并不总是出现在每个版本的Grails文档中。
每个Grails包中的lib文件夹都包含它所依赖的Groovy版本。这来自我的电脑(我已经为不同的项目安装了8个不同版本的Grails ):
grails/2.2.0/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.0.5.jar
grails/2.3.2/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.1.9.jar
grails/2.3.6/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.1.9.jar
grails/2.4.3/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.3.6.jar
grails/2.5.6/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.4.10.jar
grails/3.3.14/lib/org.codehaus.groovy/groovy/jars/groovy-2.4.21.jar
grails/4.0.12/lib/org.codehaus.groovy/groovy/jars/groovy-2.5.14.jar
grails/4.1.0.M5/lib/org.codehaus.groovy/groovy/jars/groovy-3.0.7.jar有些人甚至不厌其烦地编译和sharing data每个版本的Grails中包含的特定版本的Groovy。
这是我自己的总结:
GRAILS Groovy
version version
------- -------
2.0.x 1.8.x
2.1.x 1.8.x
2.2.x 2.0.x
2.3.x 2.1.x
2.4.x 2.3.x
2.5.x 2.4.x
3.x.x 2.4.x
4.0.x 2.5.x
4.1.x 3.0.x请注意,Grails在Groovy版本转换方面一直非常保守。还要注意,到目前为止(2021-09-28),只有Grails的beta版本(即Grails 4.1.x)支持Groovy 3.x。
Grails - Spring/Spring Boot
Grails对Spring和Spring Boot版本的依赖在Grails Documentation中可用。
例如,Grails 3.3.14使用Spring Framework 4.3.9和Spring Boot 1.5.4。Spring 4.3.9 Documentation和Spring Boot 1.5.4 Documentation都推荐Java8,但也向后兼容Java6和Java7。
同样,每个Grails包中的lib文件夹都包含它所依赖的Spring / Spring Boot版本。这是来自我的电脑:
grails/2.2.0/lib/org.springframework/spring-core/jars/spring-core-3.1.2.RELEASE.jar
grails/2.3.2/lib/org.springframework/spring-core/jars/spring-core-3.2.4.RELEASE.jar
grails/2.3.6/lib/org.springframework/spring-core/jars/spring-core-3.2.7.RELEASE.jar
grails/2.4.3/lib/org.springframework/spring-core/jars/spring-core-4.0.6.RELEASE.jar
grails/2.5.6/lib/org.springframework/spring-core/jars/spring-core-4.1.9.RELEASE.jar
grails/3.3.14/lib/org.springframework/spring-core/jars/spring-core-4.3.25.RELEASE.jar
grails/3.3.14/lib/org.springframework.boot/spring-boot/jars/spring-boot-1.5.22.RELEASE.jar
grails/4.0.12/lib/org.springframework/spring-core/jars/spring-core-5.2.3.RELEASE.jar
grails/4.0.12/lib/org.springframework/spring-core/jars/spring-core-5.1.19.RELEASE.jar
grails/4.0.12/lib/org.springframework.boot/spring-boot/jars/spring-boot-2.1.18.RELEASE.jar
grails/4.1.0.M5/lib/org.springframework/spring-core/jars/spring-core-5.3.2.jar
grails/4.1.0.M5/lib/org.springframework.boot/spring-boot/jars/spring-boot-2.4.1.jar幸运的是,对Spring和Spring Boot for Java的支持在每个版本中都是well documented。
以下是我的总结:
Spring Spring Supported
GRAILS Framework Boot Java version
------- --------- ------- -------------
2.2.x 3.1.x N/A up to 6
2.3.x 3.2.x N/A up to 7
2.4.x 4.0.x N/A up to 8
2.5.x 4.1.x N/A up to 8
3.0.x 4.1.x 1.2.x up to 8
3.1.x 4.2.x 1.3.x up to 8
3.2.x 4.3.x 1.4.x up to 8
3.3.x 4.3.x 1.5.x up to 8
4.0.x 5.1.x 2.1.x up to 11
4.1.x 5.3.x 2.4.x up to 11Tomcat - Java
Tomcat有自己的具有不同Java版本的compatibility matrix。在这里可以看到,从10.1.x开始,Tomcat支持Java 11和更高版本,但10.0.x版本仍然支持Java 8。
Groovy - Java
关于Groovy与Java的兼容性,您可以在Groovy's Release Notes files中找到具体信息。例如,根据发行说明,Groovy已经正式支持在JDK 8 staring 2.3上运行。
根据发行说明,Groovy2.5.x显然也可以与JDK9/10和JDK11一起工作,尽管它对每个版本都有一些警告和说明;而且Groovy3.0中引入了对JavaGroovy9的更好支持。
以下是我的总结:
Supported
GRAILS Groovy Java version(*)
------- --------- -------------
2.0.x 1.8.x up to 6
2.1.x 1.8.x up to 6
2.2.x 2.0.x up to 6
2.3.x 2.1.x up to 7
2.4.x 2.3.x up to 8
2.5.x 2.4.x up to 8
3.x.x 2.4.x up to 8
4.0.x 2.5.x up to 9/10/11(**)
4.1.x 3.0.x up to 11+
(*) Supported Java versions is based just on
my understanding of the release notes
(**) There are some caviats in the release notes解开谜团
现在,我们已经为任何特定的Grails和Tomcat版本组合解决了这个难题。
例如:
8
<代码>H124Tomcat9.0.x和10.0.x支持Java8和later
在您的特定情况下,假设您有Grails 3.x系列的最新版本: Grails 3.3.14:
Java 3.3.14捆绑包Groovy2.4.21和Spring 2.4.x支持Java8,但仍然缺乏对较新的4.3.25
3.3.14支持Java8,并且可能不能在Java11上运行
摘要图表
+---------+---------+-----------+---------+----------------+-------------+
| | Bundled with GRAILS | Max version of | |
| +---------+-----------+---------+ Java supported | Max version |
| | | Spring | Spring | by GRAILS with | of Tomcat |
| GRAILS | Groovy | Framework | Boot | bundled Spring | compatible |
| version | version | version | version | and Groovy (*) | with GRAILS |
+---------+---------+-----------+---------+----------------+-------------+
| 2.0.x | 1.8.x | 3.1.x | N/A | | |
| 2.1.x | 1.8.x | 3.1.x | N/A | up to 6 | 7.0.x |
| 2.2.x | 2.0.x | 3.1.x | N/A | | |
+---------+---------+-----------+---------+----------------+-------------+
| 2.3.x | 2.1.x | 3.2.x | N/A | up to 7 | 8.5.x |
+---------+---------+-----------+---------+----------------+-------------+
| 2.4.x | 2.3.x | 4.0.x | N/A | | |
| 2.5.x | 2.4.x | 4.1.x | N/A | | 9.0.x |
| 3.0.x | 2.4.x | 4.1.x | 1.2.x | up to 8 | and |
| 3.1.x | 2.4.x | 4.2.x | 1.3.x | | 10.0.x |
| 3.2.x | 2.4.x | 4.3.x | 1.4.x | | |
| 3.3.x | 2.4.x | 4.3.x | 1.5.x | | |
+---------+---------+-----------+---------+----------------+-------------+
| 4.0.x | 2.5.x | 5.1.x | 2.1.x | up to 11 (**) | 10.1.x |
+---------+---------+-----------+---------+----------------+-------------+
| 4.1.x | 3.0.x | 5.3.x | 2.4.x | up to 11+ | 10.1.x |
+---------+---------+-----------+---------+----------------+-------------+
Last Updated: 2021-09-29
(*) Supported Java versions is based just on my own understanding
of Groovy and Spring release notes
(**) There are some caviats for JDK 9/10/11 in the release notes
of Groovy 2.5.xhttps://stackoverflow.com/questions/69320081
复制相似问题