Search code examples
aws-lambdaaws-codepipelineaws-codebuild

Is there any way to speed up aws code build with maven?


I am using aws code build for java maven projects. What I observered, for each build trigger, it is downloading dependencies from maven remote repository instead its local. So It is consuming lots of time. Is there any way to speed it up ?


Solution

  • Yes, there is a way to cache Maven dependencies in an S3 bucket, which might be reused for the next builds.

    When you create the CodeBuild project, in the BuildSpec section, you have to specify the location where the Maven dependencies are downloaded:

    enter image description here

    And you also may want to create an S3 bucket and provide it as the cache location in the Artifacts section:

    enter image description here

    For full description on how to create a Maven pipeline with caching, see the AWS support page: source