how to automatically compile class files after push to git

I want to be automatically compiled class files after push a git server.
Is there a possible way?
Static files are synchronized to checkout that was using hooks post-receive, I would like to also sync class files.

Ultimately, I would like to automatically deploy web source that pushed to git server.

  • Git breaks my program?
  • Trying to compile Python fails because of files' timestamps
  • How to compile and run a simple java file in jenkins on Windows
  • Compile git for 32-bit linux on shared hosting
  • How can I make it so git rejects pushing code that won't compile?
  • Lego Mindstorms ev3 leJOS finding libraries during compilation
  • ps : I tried using ant on post-receive as below for this, but failed

    #### post-receive ################

    #!/bin/sh

    git checkout -f

    cd /d/webapps

    ant

    ###############################

  • Is this scatter-brained workflow realizable in Git?
  • Git with Dropbox Issues
  • Are git repositories copyable?
  • Ansible: how to run task on other host inside one playbook?
  • Remove some commits in GIT
  • git log: show second parent on the left
  • Git Baby is a git and github fan, let's start git clone.