Auto refresh browser on save for Grails project? - eclipse

I am working on Grails 3 project and I cannot find a way to auto-refresh browser upon save LESS/SASS files and HTML/CSS files and Groovy and GSP files. Assume I have chrome browser window opened to my application page. For quicker development it should refresh automatically when I make a change and save any of the mentioned file types in my project. Eclipse based solution is preferred but IntelliJ IDEA Community edition may be considered or other open source but well maintained and stable solution that works with Grails/Gradle projects.
FYI I am using Mac OS X.

If you use Sublime Text you can install the following plugin: https://github.com/gcollazo/BrowserRefresh-Sublime
It adds a key binding to refresh your browser on save. But this would mean starting/stopping your server using some other method. I prefer cmd line or just a terminal screen than a heavy IDE for Grails.

Related

Setting up hot deployment with eclipse and Jboss

I am used to work with rails locally where I can use any text editor I please while I have the server running. If I make changes to a file Webrick, it will pick it up and I am able to see the changes on the page.
Can I do this with eclipse?
I am using Atom for html editing but every time I save the changes and reload the page, the changes are not done. Any ideas?
Is your project an Eclipse Web project associated with a server in the Eclipse Servers view? If so, double-click on the server and you'll be able to tweak a few thing. The interesting option would be Automatically publish when resources change under Publishing.
PS: if you're using Java Enterprise or JBoss technologies, you can add JBoss Tools on top of your Eclipse IDE, it features some features and default settings that should make things simpler for you.
I've found the answer by going to eclipse in Preferences > General > Workspaces > Refresh using native hooks or polling
This way I am able to edit html files with Atom. Hope it helps someone
Question for reference: eclipse, refresh files edited by external editor

How is the Eclipse sample project "Multipage Editor" supposed to run?

I installed Eclipse Luna in XP yesterday and opened the sample project "Mutlipage Editor". When I click "Run" all that happens is another copy of Eclipse opens looking like the first copy but all the workspace boxes are empty.
I guess I was expecting either an emulator to start or the ability to run it on my Android phone. Can anyone get me started please?
When you run an Eclipse plugin it has to run in an instance of Eclipse so that all the other plugins that the plugin depends on are available.
The default 'Multipage Editor' is associated with a file type (.mpe I think). So create a file with that type and open it to see the editor.
You can also write an Eclipse Rich Client Program (RCP) where you can select the available plugins and the look of the UI, but this requires additional code.

Sublime Text 2 edited file-changes does not show when refreshing browser in Maven project

I am having problems when editing template-files(HTML-files) in my Maven-project. I have made the Maven-project an Eclipse-project with the command "mvn eclipse:eclipse" (if it matters). I am using the Apache Velocity Engine as template engine for this project.
The problem arises when I'm editing the files in Sublime, and then save the file and refresh the browser. The changes does not show! If I however open the template file in Eclipse, just open it, I can even just open and close it right away, and THEN refresh the browser, the changes will show.
I have done a test to see if this problem occurs on other simple projects as well, and with a single HTML-file and a simple http-server, the work I save in Sublime shows as normal.
Does anybody know what is happening here? Am I bound to keep on using Eclipse as a HTML-editor? :( Does the Eclipse project files prevent me from using other editors? Why are the changes only showing when I open the files in Eclipse?
Any help is greatly appreciated!
In order for the changes to take place you have to right-click the file in Eclipse explorer tab and choose "refresh" in order for the (static) changes to be reloaded to Apache. For dynamic changes you'll need to restart apache or use a plugin such as JRebel.
Eclipse copies the files to the "target"-folder in the webapp. Sublime(and others) does not do this automatically, so you need to do this manually, or by a plug-in that will copy the files on save.

Integrate Sublime Text with Tomcat

At work, we develop Java applications and are using Eclipse. As a frontend dev I would like to switch completely to Sublime, but it's missing a feature of Eclipse, I can't work without it.
When developing, I had to build the project with Maven and publish it to a Tomcat server. Eclipse does this all automatically and also republish changed files.
I came so far, building the app with Maven and publish it to Tomcat with the Maven-Tomcat plugin. But with Tomcat 7 republishing isn't possible and changed files aren't copied to the working directory. So I have to leave Eclipse open and refresh its workspace everytime I changed files in Sublime.
Would it be possible to integrate this functionality into Sublime with any plugin?
Rather than deploy to a specific Tomcat 7 container that you ave set up yourself, I would instead use tomcat7:run to start a live container based on the unpackaged web app.
That should get you pretty much exactly what you are after.
If you don't mind switching to jetty as a server container jszip:run can get you even more, but I'm still working on getting that plugin to beta quality so ymmv
What about this plugin https://github.com/nlloyd/SublimeMaven? I'll try it tommorow and then I'll let you know if it do the job (if it will work with ST3).
Eclipse has a feature for this. Select "Refresh using native hooks or polling" and "Refresh on access". You should select both. I have tried only selecting "Refresh using native hooks or polling", but it works only when you keep open the specific file in eclipse and modifying it outside. "Refresh on access" also not working alone. With these options combined it works charmingly.
PS: Native hooks available only in Windows. For Linux and Mac polling is used. I don't know how efficient it is.
I had this problem too. The workaround, is to open both eclipse and sublime, and instead of refreshing your project manually in eclipse every time you have made some changes in sublime, u can can use this plugin https://github.com/psxpaul/EclipseJava7Refresher to make the refresh automatically.
PS : As mentioned by #Kapil Dev S, eclipse (with "Refresh using native hooks or polling" checked ) can refresh automatically resources when changed, but it doesn't detect changes as soon as it happens (it takes some seconds, at least for me on Linux)

Is there a way to open a file browser view within Eclipse?

I am working on using Eclipse as a basic file editor, without all the heap issues that comes with a Java tools install. I downloaded the platform version with no plugins, and added some editing tools for the code I wish to develop.
I do not intend to create new projects in this Eclipse, but would rather just edit individual files. Ideally, I can just open these from a File Explorer view within Eclipse (see image). Is there a plugin that I can download that will allow me to do this, or is there a simple hack to get this feature added?
I found a solution. It unfortunately adds nearly 30MB, and I was really hoping for a lighter weight solution (I will not choose this as the answer yet, in the event one is posted). The Target Management plugin provides a plugin (add this url to Eclipse's Install New Software... dialog: http://download.eclipse.org/tm/updates/3.4/ ) that allows the browsing of remote and local file systems. Opening the view Remote Systems will allow you to open the local file system and open files from within, that appear in the main editor window.