necromancer
necromancer

Reputation: 24641

How to automatically update a file on every git commit?

I want a file in my repository to be automatically updated (with any value, I just want its timestamp to be changed) with every git commit. How can I do this?

My reason is to force my Glassfish appserver to reload my webapp when I build it on the server. I need to touch a file called .reload for this to happen. Rather than doing so manually, I want git pull origin; mvn build on my server to also touch the .reload file.

Upvotes: 0

Views: 707

Answers (2)

necromancer
necromancer

Reputation: 24641

git-hooks, thanks to the commenters on my question above, seems to be the way to go. maven cargo, thanks to the other answer, is a good way too; in fact, perhaps better for deployment, but if you want to do something more general git-hooks is better.

Upvotes: 0

Manfred Moser
Manfred Moser

Reputation: 29912

You could just use the Maven Antrun Plugin or the Groovy Maven Plugin or even the Maven Exec Plugin to execute a touch of the .reload file. However you could also just deploy the application to the Glassfish server as part of a build using e.g. the Maven Cargo Plugin .. then you would not even have to touch the reload file because Maven would redeploy the app on the server as part of the build..

Upvotes: 3

Related Questions