适用于Spring引导项目的AWS Beanstalk上的Java 11 [英] Java 11 on AWS beanstalk for Spring boot project

查看:89
本文介绍了适用于Spring引导项目的AWS Beanstalk上的Java 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Spring Boot的新手,我正在尝试开发一个应用程序,以便以后将其部署到AWS Beanstalk上. 我使用Java 11开始了该项目,但后来发现AWS仅支持Java 8. 是否可以将pom.xml中的'maven.compiler.target'设置为1.8,以使其正常运行? 我必须同时使用Java 1.8进行开发和编译吗? 我想使用新的Java功能和库. 如果有人遇到同样的问题,我想发表一些意见. 谢谢. 镉

I'm new to Spring Boot and I'm trying to develop an application to later deploy it on AWS beanstalk. I started the project using java 11 but later I discovered that AWS only support java 8. Is it possible to set 'maven.compiler.target' in pom.xml to 1.8 to make it running correctly? Should I have to use Java 1.8 for both development and compile? I would like to use new Java features and library. I would like to have some opinion if someone have same problems. Thanks. Cd

推荐答案

您可以使用

You can install java 11 on your instances using ebextensions. Just create a folder .ebextensions in your source bundle and add there one file with following name 10_java.config and content:

[更新:yaml文件的固定格式]

[UPDATE: fixed formatting of the yaml file]

container_commands:
    100-remove-old-java:
        command: "sudo yum remove -y java-1.8.0-openjdk-headless"
    200-download-rpm-package:
        command: "wget https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/java-11-amazon-corretto-devel-11.0.4.11-1.x86_64.rpm "
    300-install-java:
        command: "sudo yum localinstall -y java-11-amazon-corretto-devel-11.0.4.11-1.x86_64.rpm"

这将删除默认的Java 8并安装AWS'发行版.

This will remove default java 8 and install AWS' distribution of java 11.

这篇关于适用于Spring引导项目的AWS Beanstalk上的Java 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆