Does serverless support a maven style dependency management?

We do not want to commit all dependent modules into bitbucket everytime when we develop a new lambda function. Can we configure it such that it pulls the dependencies from a common repo and build the package and deploy ?

You should use whatever package management your language of choice (currently limited to Python, NodeJs, and Java) recommends. Serverless is a deployment framework; it makes no decisions (and has no preference) on dependency management.

And to add what @rowanu said we even have a Maven template that uses normal Maven dependency management and simply installs dependencies in the final zip file and pushes it to AWS. So you should be all set.

1 Like

Thanks for the info. How we do it when the development env is nodejs?

NodeJS by default installs dependencies into a local node_modules folder which will be picked up by default. Nothing additional to do really

I tried through package.json (defined the dependecies) & configuring the package options (include) in serverless.yml file and it did not work.

package.json >>

},
“scripts”: {},
“dependencies”: {
“async”: “2.1.1”
}
}

serverless.yml >>
package:
include:
- C:\Users\U24285\AppData\Roaming\npm\node_modules\async

Am I doing anything wrong here?

I also made sure the modules are installed in nodejs. The issue is, modules folders are not being added in the deployment package. So it fails when run saying 'Cannot find module ‘async’

I found this - http://stackoverflow.com/questions/37169377/serverless-framework-how-to-add-external-npm-packages. but looks weird.

I think it may be like this. Define a npm packag.json in the application root directory and run an npm install --save option to download all dependencies. This will create a node_modules folder under root and the same will get added to the the deployment package. (That we can avoid commiting these modules into the bitbucket)

May be I am wrong, any thoughts?