简体   繁体   English

构建AWS Lambda jar

[英]Building AWS Lambda jar

What is the standard practice for creating AWS Lambda jar. 创建AWS Lambda jar的标准做法是什么。

Should we bundle the dependencies as jars within the zip file or should the dependencies be unjarred and included as classes. 我们应该将依赖项打包为zip文件中的jar,还是应该取消依赖项并将其作为类包含。

As far as I know it is the first option that holds true, but this doubt came to mind when I was following the AWS Tutorial of thumbnails and it eventually created a jar that had classes for dependencies (like Jackson) rather than bundling Jackson jar in the artifact. 据我所知,这是第一个正确的选择,但是当我遵循AWS缩略图教程时,这个疑问浮现在脑海,它最终创建了一个具有依赖项类的jar(例如Jackson),而不是将Jackson jar捆绑在其中。神器。

Is there a sample AWS Lambda zip file that I can download and try (the one that has dependencies bundled as .jar files and not as .class files) 我是否可以下载并尝试一个示例AWS Lambda zip文件(将依赖项捆绑为.jar文件而不是.class文件的文件)

You should include the dependency jars in a lib subdirectory. 您应该在lib子目录中包含依赖项jar。 If you have a class mypackage.LambdaFunctionHandler , the zip file should have this basic structure: 如果您有类mypackage.LambdaFunctionHandler ,则zip文件应具有以下基本结构:

.
|-- mypackage
|   +-- LambdaFunctionHandler.class
+-- lib
    |-- myjar1.jar
    +-- myjar2.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM