My company has elected to go with IntelliJ for development and deployment to a local Tomcat server. I have been doing my development on gVim, and have no desire to change.
When we were using eclipse I was able to have eclipse republish resources when the file was changed externally. ( I beleive the setting was Refresh using native hooks or polling) This was wonderful because I prefer to use command line tools to integrated ones.
We are using IntelliJ to manage the server, which I'm okay with, however I would like to not disrupt my current workflow.
I know IntelliJ stays in synch pretty well, and will update the files when I focus on it, and refresh them when I leave the frame.
Is there a way to have intelliJ update resources that have been changed externally ( Gvim, cli git... ext ) without moving to it?
Sadly, I have been unable to find a way to monitor external changes and update a Tomcat server inside IntelliJ.
I have implemented a workaround using grunt. ( a node.js task runner )
The theory behind this workaround is simple:
Some benefits of doing it this way are:
Down side is
To learn more about grunt and get it set up you can visit gruntjs.com.
This workaround uses two plugins
First you set up a task that copies your files into your exploded war. This will use the grunt-contrib-copy plugin and will probably take some finagling, but it isn't too bad. Mine looks like this:
copy:{
webfilesToOutdir:{
files: [
{expand: true, src: ['WebContent/**'],
dest: '../out/artifacts/attensity-q/exploded/attensity-q.war',
rename: function(dest, src){
var ret = dest+"/"+ src.replace('WebContent/', '');
return ret;
}
}
]
}
}
Next you will need a task to watch your files and run the copy when something changes. This will use grunt-contrib-watch and again it is nothing to bad, you will just need to adjust the paths. Here is mine:
watch: {
web: {
files: ['WebContent/**', '!WebContent/less/**'],
tasks: 'copy:webfilesToOutdir',
interrupt: true
}
}
I hope this helps. I've been using this solution for some time now and it has done its job pretty well. Good luck, gentle men.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With