automatically disable "build automatically" in eclipse during ant run - eclipse

Is there a way to automatically disable the "build automatically" setting in eclipse while an ant build is running?
It should listen for an ant task being started
check if the setting is enabled
disable it temporarily
listen for the ant build to finish
restore the previous setting
I would like to have this, because having this enabled makes my ant build take ~10 minutes and having this setting disabled lets it finish in ~5 minutes. I often forget to always change the setting and so I waste lots of time waiting. Having this automated would improve my build-cycles.
If there is nothing out there yet, I would be willing to write a plugin for this. In that case does anyone have pointers about how to listen for the events and change the setting? :)
EDIT:
I want to fix this for manually started ant builds via right clicking the build.xml and clicking run as -> ant build. I do not use ant builders in my eclipse project configuration.

I suggest that you narrow down what resources you actually want to refresh in the Ant Builder's Refresh tab
and/or move Ant Builder behind Java builder in the Builders configuration.

Related

Configure eclipse to perform different tasks on save

I migrated my projects to use the Gradle builds for all actions (building, testing, etc). When I save in eclipse, it builds with the default eclipse actions. Is there a way to change eclipse's behavior so that when I hit the save button or Ctrl-S it will run gradle build?
In the Project Properties on the Builders page you can control which builders are run when the project changes. You can disable existing builder and add new one using either Ant or running a program.

Refreshing eclipse-project at the end of a maven build

Is there a possibility to refresh the files and folders of a project within eclipse at the end of a maven build automatically.
Usually I'm building from commandline. After a build e. g. the target folder should be refreshed.
Additional info: the maven build runs in the command line and eclipse should update automatically when it ended.
Use Run as -> Maven build... In the run configuration/build properties go to the refresh tab and select the refresh option you want.
Note that the eclipse build and the maven build may interfere, so make sure that you turn off the Build automatically option in the Project menu before staring the maven build. You may get indeterministic compilation errors otherwise.
Here is an eclipse plugin that implements the external hook for refreshing: https://github.com/andrask/maven-eclipse-control-plugin
I dont think so, there is no option to link the two things.
But eclipse has an option Refresh on access which might be useful for you.
For me, the accepted answer of using Run as -> Maven build... and the Refresh option did not refresh the target folder in Eclipse. I needed to do the following:
Preferences -> General -> Workspace -> Refresh using native hooks or polling
When enabled, any changes made by external editors will be automatically discovered by the Workbench. On some systems there may be a slight delay if polling is used.

Eclipse - how to start remote debugging without automatically rebuilding

[using Eclipse 3.6 and Preferances -> Workspace -> build automatically is disabled]
I have a project setup that includes a number of scripted steps for generating autogen code (jaxb, etc). It also automatically produces and deploys (does not start) my jars to a remote server. Unfortunatly this whole process can take upwards of 2 minutes.
Recently I've been remotely debugging one project by starting it on the remote server with a manual script that enables remote debugging then attaching to the remote debugging session with eclipse. My problem is that even if I have not made any source changes, eclipse performs a rebuild when I start the remote debugging session. This is really annoying. Does anyone know how to start Eclipse's remote debugging without automatically performing a rebuild?
You probably have figured this out, but for sake of future reference, to accomplish this:
Window > Preferences > Run/Debug > Launching. Uncheck build(if required) before launching.
Did you try this:
On "Project" menu, uncheck the "Build Automatically"
The down side is that now you'll have to invoke "Build" manually each time you need.

Ant build consoles get clobbered by dependent projects in Eclipse

I have a set of dependent projects in Eclipse, each with its own Ant build script. If I make a change in multiple projects, then select "Build All" (Ctrl+B), each Ant build is invoked in the correct order. But if there is an error in one project, Eclipse still tries to build the other projects also, and in the process clobbers the Ant console so that the build errors are no longer visible. This wouldn't be quite so annoying if I could open up the offending project and select "Build Project", but Eclipse out-smarts me: it won't rebuild until I open some file in the project, edit it, and save (typically I add and remove a space character wherever my cursor happens to be). An answer to any of the following questions would be welcome.
How can I configure Eclipse to (in preference order):
terminate a "Build All" as soon as any project's Ant build fails?
save all console output for "Build All" instead of resetting the console for each project?
spawn a separate console for each new instance of Ant?
allow me to force a "Build Project" even if it doesn't think anything has changed?
[UPDATE] Bonus Question:
How can I configure Eclipse so that fixing any build errors in a depended-on project counts as a "change" for the purposes of "Build Project"?
Have you tried redirecting standard out to file via a run configuration? A few screen shots to help if not... (you may try 'append' this is not in my screen shot :) )
One alternative is to have each Ant build log itself, e.g., using the following in build.xml
<record name="build.log"
loglevel="verbose"
append="false" />
Oddly, Eclipse seems to disable this logging somehow when running an Ant build.
I am not too big on ant, but can't you make the builds dependent on one another?

Stop Eclipse restarting my web app on file save

I'm creating a JSF/Facelets web app in Eclipse. I've configured my project to use a Tomcat (6.0) server that is started/stopped by Eclipse.
Whenever I save a file (eg .xhtml) Eclipse restarts the app, trashing my HTTP session. This is annoying, because I'm frequently updating my .xhtml files, and the app doesn't need restarting to detect the changes.
Is there a way to stop Eclipse restarting the app? Specifically, can I configure Eclipse to only restart the app when I save files of a certain type?
In the server View, double click on your Tomcat instance.
This will open the properties of your Tomcat server.
As I am not sure of which parameter will help you to solve your problem, check the following options in the latter view:
Automatic Publishing, option "Override default settings" selected, 1 second for the publishing interval.
In server options, uncheck options "Server modules without publishing" and "publish module contexts to separate XML files".
In the modules tab, for each modules deployed, check that Auto Reload is enabled.
Hope this will help you.
I have always used this and it works fine for me. The context is reloaded only when you change classes or the web descriptor.
In your project structure where you keep .xhtml files which makes eclipse reload the context on changing?
This can happen if you have a builder in Eclipse set to deploy on save. Right click on your project -> properties -> builders
Turn off "Build Automatically"