Are there any tools/libraries like Guard (for Ruby on Rails) for Java which listen to file system changes i.e. changes to the code files in the project and automatically run unit tests associated with that class or the entire project.
-
You can setup a continuous integration system which checks for changes in your version control and makes you a new build (including running your tests) – Robin Nov 17 '12 at 21:09
-
@Robin we do have a continuous integration system but I needed something which I can use on my system before checking-in and independent of the central CI server. – sandeepkunkunuru Nov 17 '12 at 21:30
3 Answers
Looks like you need something like Jenkins, running locally + FSTrigger plugin.
But if you need to monitor file system changes from your app (Guard is general-purpose tool), there is discussions on Stackoverflow about it:
Is there a sophisticated file system monitor for Java which is freeware or open source?
The interesting thing is that yes, Guard.rb does support java thanks to the guard-java gem. Best thing of all is that this does support maven, ant, or what ever your build system is. This allows for setting up jenkins and cucumber then having guard run your tests as you edit the features/source code.
Add the following to your project's Gemfile:
gem 'guard-java'
Then issue bundler install && guard init java
The rest can be read at https://github.com/infospace/guard-java

- 1,472
- 16
- 22
I don't know if you are still up for an answer but I wrote a small tool, inspired from Guard, that could do what you want:
https://github.com/athieriot/JTaches
It uses the Watcher API available in Java7
Hope it helps

- 5,853
- 2
- 24
- 25