eclipse: auto build after save - eclipse

I have an ant script that creates runnable jar and I want it to run each time I make changes in my code and save them. I guess I need some "auto build after save" option in Eclipse. Is there such a thing?

You could declare your script as a builder, and make it run "during auto build".
See the properties of your project: you can add an external program (above) or an an script (below).
If you can export your script as an ant script, like the OP David B did in his answer, it becomes quite easy:
Export as an ant script: right-click the project -> export -> runaable jar file, tick "save as ANT script" and finish.
Add the ant script as a builder: right-click the project -> properties -> Builders -> new (Ant).
Paste the path for the ant file, go to "targets" tab and click the "set targets" button next to "auto build".
Finally, click OK, OK, OK.

Actually, the best solution I found was: right-click the project -> export -> runaable jar file, tick "save as ANT script" and finish. Now right-click the project -> properties -> Builders -> new -> paste the path for the ANT file, go to "targets" tab and click the "set targets" button next to "auto build", OK, OK, OK.

Use an ANT file which will be triggered everytime you save a file: Using Ant to Auto-Build in Eclipse

Related

How to add JUnit to my Eclipse and how to run it?

I want to try some tests,and have accidentally removed JUnit
My prefrences in Eclipse
I have found
http://scala-ide.org/docs/current-user-doc/testingframeworks/index.html
What is my next step?
Try "Restore Defaults", or re-install Eclipse.
Once you have re-enabled JUnit, to run a test just right-click on the class and choose "Run As" -> "JUnit Test"

Run as Ant build' Missing in my eclipse

I am unable to right click and run my build.xml file by choosing 'Run as Ant' . Whenever I click it says run configuration and that goes into running Java file options .
This works for me.
Go to..
1. Help -> Install New SoftWare
Work With -> "http://download.eclipse.org/releases/juno"
Drop down list "General Purpose Tools"
select "Eclipse Plug-in Development Environment"
After doing this...eclipse started showing option of Ant Build in Run as
In Eclipse Neon, the Ant Build moved to Run > External Tools > External Tools Configurations ... it is not located in the default Run anymore.
An example of a build xml file and how to run it
I hope this helps!
I encountered a configuration where depending on the filename of build.xml file the "Run As" menu did not contain the "Ant Build" and "Ant Build..." commands. The commands "Ant Build" and "Ant Build..." (see the image in ricardoramos's answer) are present if the build file is named build.xml, but absent if the file is named build-something.xml.
I tracked down that the cause of this issue in my configuration was plugin LiClipseText. Uninstalling the plugin resolved the issue. I observed this with LiClipseText version 2.1.2 and with Eclipse versions "2018-09" (4.9), "Photon" (4.8) for Java EE Developers.
The plugin provides its own editor for XML files, and I guess that interferes with the way how Eclipse detects that an XML file is an Ant build file.
It may be that this will be fixed in a future version of LiClipseText.
For a recipe on how to uninstall the plugin - see question 6174725. For a cleanup afterwards - see question 221476.
Another possibility is your build.xml file is not parseable by ant
For example, if you open the Ant Perspective (Open Perspective | Other | ant) and then choose the Add Buildfiles toolbar button, then choose your build.xml file, if it is not a valid build file, you may see an error message "Unable to parse as an ant build file".
Once you fix your build.xml file, the Run As ant RMB command on the build.xml file will appear.
(above was my experience on Eclipse Mars.2)
Follow the below steps.
Go to Windows -> Preferences -> General -> Content Types -> Text -> XML -> Ant BuildFile.
Just click on Add button and add your AntBuild file. click ok.
Restart your Eclipse.
Follow the below steps.
Go to Windows -> Preferences -> General -> Content Types -> Text -> XML -> Ant BuildFile.
Just click on Add button and add your AntBuild file. click ok.
Workaround:
Open the ANT-View, add the build file and start it from there.
(Had the problem in JBDS8 after installing IBM Diagnostics Tools)

How to execute the go test file in the goeclipse IDE

How do I create a eclipse launch file to execute the test file or run configuration in the goeclipse IDE
This is an enhancement which is pending: issue 5
I was thinking more along the line of adding a menu item ("Test go application") in the "run as" context menu.
Right now if I select a go test file and click "Run go application" from the "run as" context menu nothing is executed (no main).
A "Test go application" could do a "go test" on the file instead of a "go run"...
For now, there is only an option "Enable continuous testing":

Run ant deploy script on eclipse save

I have an ant deploy script I would like to run each time I do a file save in eclipse.
Thanks
Vickus
First, you have to set up eclipse so it builds your project when you save. You do this under "Preferences -> General -> Workspace -> Build Automatically".
Second, you have to register your ant builder. Do this via Project -> Properties -> Builders -> New. Here you can select an ant builder and configure it to your preferences.

upload only current file with netbeans

I'm using netbeans 6.9.1 to work on a php project, how do I manually upload a file without having to 'run' the project?
Under the options->keymap, I mapped Ctrl-L to upload, which is easy enough.
The only other place to upload is to right-click the file in the project browser and 'upload', unlike aptana there's no button for it, which is what got me stumped.
If you have the project's "Run Configuration" properly configured as a "Remote Web Site (FTP, SFTP)", then simply right-click on the file in the "Projects" pane and click on "Upload" in the file's context menu.
If you want to upload automatically on save instead of on run,
Right-click on the project node in the "Projects" pane (it's the top-most node in the tree)
Click on "Properties" in the project's context menu.
Click on "Run Configuration" in "Categories"
Change "Upload Files" to "On Save"
Click "OK"
If you sometimes want to upload on run, sometimes on save, sometimes only manually, sometimes to one server, sometimes to another server, or any combination of the run configuration options, then you can click on the "New..." button to create and save one or more run configurations. You can then choose which one is active on the run configurations project properties page, or set it through "Set Configuration..." on the project's context menu.