Integrate Sublime Text with Tomcat - eclipse

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)

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

Auto refresh browser on save for Grails project?

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.

Eclipse stop background refresh

Eclipse 3.7
This is not related to How do I stop Eclipse from refreshing some dir? as I am okay with eclipse project refresh on startup.
I have my project sources in a network drive (I need to use Eclipse in Windows and Run the code in Linux). Periodically Eclipse freezes and I am fairly sure this is because Windows is frantically trying to access the NAS area and it is slow. I would not be changing the source files outside of Eclipse so I don't need features in eclipse such as refreshing a file when it is changed in background.
Questions
Are there any known ways of speeding this up? Suggestions like disabling local history, refreshes etc?
I also have a feeling that this freezing is because Eclipse tries to actively detect if files are changed in a file system and when you do that over several files it causes delays (I can be wrong on this). Is there any way to disable this? (In IntelliJ I could do a background refresh)
Look at Preferences / General / Workspace and see if Refresh using native hooks or polling and Refresh on access are checked. If so try turning them off.

New to Aptana, two questions on deployment

I've moved to Aptana from DW (mainly to get better Phonegap/Android integration). I'm using Aptana integrated into Eclipse (i.e. installed Eclipse and then added Aptana).
I have two questions.
How can I configure Aptana/Eclipse to copy files to my local development server when I want to test? I can clearly do this in the filesystem outside the IDE, but would like it inside on a button or menu.
How can I configure the process to use, for example, the Google closure tools for js and css as part of my build/deployment process? I'd like to automatically minify the js and/or be able to use the css extensions offered (variables).
I get the feeling that all this should be possible since Eclipse is so configurable, but I don't know where to start. Would Ant do this for me? How?
Would appreciate some pointers.
Thanks
Abo
I can answer your first question.
If you have the Aptana plug-in installed, you will have an option on your right-click menu titled "Deploy". Expanding the deploy setting will reveal the option to "Run Web Deployment Wizard...". From here, if you are using a web server as mentioned, you will probably want to choose the FTP/SFTP/FTPS option. Fill in the form with your servers information and be sure to run a test to make sure things are working properly.
I always check the "Automatically sync my changes with the remote site" box and then select the "Automatically sync in both directions" radio button. This will automatically deploy my current file to my web-server upon a save.
You may also want to only select the "Automatically sync from my machine to remote site", the reason I choose both ways is because I sometimes work from different machines and it helps me keep things in sync. A little tweaking and it should save you a lot of time and effort!
[Using Indigo Release 1, and Aptana Studio 3]
Aptana don't include support for "Google Closure", you can instead use "Eclipse" or "WebStorm".
I hope below links will help -
http://www.daveoncode.com/2009/11/23/automatically-compile-javascript-applications-using-google-closure-and-ant/
and this stack exchange thread -
Google closure compiler usage WebStorm

Can Eclipse refresh resources automatically?

Eclipse (3.4.2 with PyDev) deals with out-of-sync resources (files that have been edited outside of the IDE) differently from other IDEs that I've used, where only resources with editors open are considered out-of-sync. In Eclipse, any resource can go out of sync.
This means that when I perform a search after any file has changed outside of Eclipse, I get an error dialog telling me that files are out of sync, even if they have no open editors. As far as I can tell, there is no global refresh command, so I'm forced to read the project names (I have several projects) in the error dialog, and do a right-click + refresh for each of them.
I've checked the Refresh Automatically setting in Settings > General > Workspace, but this has no effect. Is there any way to get Eclipse to always just load non-active resources from disk?
This issue will be fixed in Eclipse 3.7 (Indigo). While "Refresh Automatically" does eventually bring resources back into sync, the refresh hook only exists for Windows, so on Linux and Mac OS it has to poll the filesystem periodically.
From 3.7 there's a new preference Settings > General > Workspace > Refresh On Access (aka Lightweight Refresh). This preference causes Eclipse to automatically refresh resources when it discovers that they're 'out-of-sync'. When opening, reading or searching files, it'll prevent out-of-sync errors from occurring.
See also: https://bugs.eclipse.org/303517
I think if you click on the project node in the Project Explorer and press F5 or right click and select Refresh, all resources for that project will be refreshed. Also, if you CTRL+click on multiple projects, you should be able to refresh multiple projects at the same time.
A single click on a project, a CTRL+A to select everything, and an F5 should do exactly what you need - refresh everything.
I'll have to test this when I get the chance, but I believe this is how I overcame similar problems in the past.
I've noticed that this answer routinely is getting down voted. I'd like to point out that the question refers to a specific version of Eclipse: 3.4.2. There was actually no automatic method to refresh out-of-sync resources until version 3.7 Indigo of Eclipse, as mentioned in James Blackburn's answer. The method described in this answer is the only method to achieve this in version 3.4.2 (and any other version before 3.7 Indigo).
Out of synchronization problem is common in eclipse IDE so you have to check this option windows -> preference -> Workspace -> refresh using native hooks or polling.
Eclipse Helios possesses a built in refresh feature at Preferences > General > Workspace. It's in the same spot where you disable automatic builds. Select refresh automatically. A plugin with the same functionality is Andrei Loskutov's Filesync Plugin. The update site address is: http://andrei.gmxhome.de/eclipse/. During installation, select Eclipse 3.5-3.7 plugins > FileSync.
Given that Java 7 has an api for filesystem hooks, one would think that refresh could be handled better in Eclipse.
Edit: Actually, there is a plugin that uses this mechanism: https://github.com/psxpaul/EclipseJava7Refresher
There is a global refresh - have nothing (or everything) selected in the package explorer and press F5 (or right-click on empty space and select Refresh). Of course, this could take rather long if you have large projects.
The global refresh actually exists in plain Eclipse without any plugins and without selecting every project in your workspace.
Basically you need to deselect everything in your project explorer and hit F5. To do that Ctrl+click the selected resource in the project explorer and hit F5.
A global refresh is really missing in Eclipse. The above procedure with selecting all projects and then running refresh (e.g. F5) does not work if you have closed projects included in your selection. This means, if you have 1/2 of your many projects closed as I do, you find yourself manually Ctrl-clicking through your dozens of projects. This is quite painful. I wish Eclipse would simply ignore closed projects.
Perhaps you should add a feature request on the eclipse site:
https://bugs.eclipse.org/bugs/
I think it would be a great idea to add a preference for automatically refreshing out of date resources.
Yes, Refresh on Access is long overdue ... those answers to this and similar enquires usually suggested enabling the global auto-refresh, which could take an age for large remote projects.
In fact there are those who would say that Refresh on Access should have been the original (< 3.x) default behaviour ...
I managed to solve this by creating a new "external tool" run config that executes a blank batch file. In the run config, you can have it refresh the workspace when complete. Then I created a macro using Practically Macro that 1) executes the last external tool run config (refreshing the workspace), then 2) executes the last debug run config (running my app). If you uncheck "Allocate console" then the completed external tool entry won't show up in the debug window.
Even if the solutions proposed by others perso are indeed correct, you have a "Refresh All" plugin for Eclipse. Simply add the Update page to your Eclipse list of update sites to install it in your IDE.
For Starting up there is an option to automatically refresh files in
Window -> Preferences -> General -> Startup and Shutdown -> Refresh workspace on startup
Click it in order to have a "fresh" start in eclipse. :)
Version: Eclipse 4.12