首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Grails 3服务器可以部署在Tomcat 10上吗?

Grails 3服务器可以部署在Tomcat 10上吗?
EN

Stack Overflow用户
提问于 2021-09-24 19:13:04
回答 1查看 138关注 0票数 0

我能够在Tomcat8.5.x和Tomcat9(运行Java8)上部署Grails3Server。我似乎不能让它在Tomcat10上工作,我想知道这是否可能。有没有包含Grails、Tomcat和Java的版本矩阵,有人可以给我指出来?

EN

回答 1

Stack Overflow用户

发布于 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 ):

代码语言:javascript
复制
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。

这是我自己的总结:

代码语言:javascript
复制
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 DocumentationSpring Boot 1.5.4 Documentation都推荐Java8,但也向后兼容Java6和Java7。

同样,每个Grails包中的lib文件夹都包含它所依赖的Spring / Spring Boot版本。这是来自我的电脑:

代码语言:javascript
复制
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

以下是我的总结:

代码语言:javascript
复制
         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 11

Tomcat - 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的更好支持。

以下是我的总结:

代码语言:javascript
复制
                    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版本组合解决了这个难题。

例如:

  • Grails 2.4.0捆绑包Groovy2.3和Spring4.0
  • Groovy >= 2.3正式支持JDK8
  • Spring4.0.x最多支持

8

  • 因此Grails 2.4.0支持Java8

<代码>H124Tomcat9.0.x和10.0.x支持Java8和later

  • Therefore您可以在Tomcat9.0.x和10.0.x上运行Grails 2.4.0 <代码>H227<代码>F228

在您的特定情况下,假设您有Grails 3.x系列的最新版本: Grails 3.3.14:

Java 3.3.14捆绑包Groovy2.4.21和Spring 2.4.x支持Java8,但仍然缺乏对较新的4.3.25

  • Groovy versions

  • Spring 4.3.25的支持,因此

3.3.14支持Java8,并且可能不能在Java11上运行

  • Tomcat9.0.x和10.0.x支持Java8和later

  • Therefore您可以在Tomcat9.0.x和10.0.x上运行 3.3.14,但不是Tomcat >= 10.1.x上的,它需要Java11或更高版本的

摘要图表

代码语言:javascript
复制
+---------+---------+-----------+---------+----------------+-------------+
|         |      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.x
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69320081

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档