title: How to create a codepipeline to build jar file from java code stored at github and deploy it to lambda function?
body: <p>I want to build a codepipeline that will get the code(java) from github build a jar file and deploy it to aws lamda(or store the jar in a specific S3 bucket). I only want to use tools provided by AWS platform only.</p>
  
  <p>If I am using only Codebuild I am able to build jar from the github code and store it to S3(<a href="https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started.html</a>) and I am using a deployer lamda function to deploy the code to my service lamda. Whenever there is any change in the S3 bucket deployer lamda gets triggred. </p>
  
  <p>DrawBack: Problem with this is I have to run codebuild manually everytime after commiting changes to github. I want this codebuild to detect changes automatically from github.</p>
  
  <p>To solve the above issue I have made a code pipeline which detect code changes using github webhooks but here it is creating zip file instead of jar</p>
  
  <p>So  what I am actually trying is:</p>
  
  <p>GitHub(changes)--->codebuild-->store jar file to specific S3 bucket with specific name or deploy to lambda</p>
  
  <p>buildspec.yml</p>
  
  <pre><code>    version: 0.2
  
      phases:
    build:
      commands:
        - echo Build started on `date`
        - mvn test
    post_build:
      commands:
        - echo Build completed on `date`
        - mvn package
  artifacts:
    files:
      - target/testfunction-1.0.0-jar-with-dependencies.jar
  </code></pre>