How to automatically update Targets for an Ant build via Eclipse with new run configurations - eclipse

We are creating some JUnit tests as part of QA development. So we are doing this daily and while running individual tests, or part of a package, they do appear under the Run arrow:
they do not appear in the Ant build Targets:
Well.. you can see that the Schedules_Load appears but that's because I have exported the Ant build again.
Note that even if I create Run configurations using the Eclipse menu:
It still doesn't update my Ant Targets list..
Under the menu item Project I do have Build automatically checked but don't think it makes any difference anyway, just thought I would mention it.
So is there any way to automatically update Ant targets with new run configurations without having to export the Ant build again?
Thanks.

try selecting the check-box: "Refresh automatically".
Window->Preferences->General->Workspace->"Refresh automatically"
(source: avajava.com)

Related

Second Eclipse plugin project seems to be interfered with by first -- why?

I created a plugin project using the Eclipse wizard, wrote a little code and then created a second project without any change. When I run the second project so that it creates an instance of Eclipse for testing, I see the behavior of the first project. I am guessing that both projects share some directories or something. Can it be explained what is happening and how to create two plugin projects in same workspace?
You can have any number of plugins in a workspace, one of mine has 52.
Note that when you test a plugin using 'Run As > Eclipse Application' Eclipse normally includes all the plugins in the workspace in the run. So you would get both your plugins included.
If you don't want both plugins included go to 'Run > Run Configurations' and edit the plugins list in the run configuration. You can duplicate run configurations to create as many different setups as you need.

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.

Why does CDT rebuild my C-project on Ant build in unrelated project?

I have an Eclipse workspace where a CDT project lives together with other unrelated projects. However, when I run "build as Ant build" in one of those projects, CDT insists on rebuilding its projects too.
Anyone have any ideas where to look to disconnect this "hidden" dependency? (And no, it's not in the "Linked Resources" or the "Project References"...)
The workspace wide build was actually caused by me failing to find the option for the build in "External Tools Configurations". There you can specify to build the whole workspace, the containing project, or some specific resource.
There is also an Eclipse bug for setting the default to something different than to build the whole workspace. (One could think that "Run as Ant build" would default to not build anything except running the specified Ant target.)
Project builders are run at the request of some build trigger. This might be resource changes (when you have build automatically enabled) or it could be the build action you're using: "build as Ant build". The build action may be inadvertently requesting a build of the whole workspace.
Put the following in a text file:
# Eclipse build
org.eclipse.core.resources/debug=true
org.eclipse.core.resources/build/interrupt=true
org.eclipse.core.resources/build/invoking=true
org.eclipse.core.resources/build/needbuild=true
#Managedbuild
org.eclipse.cdt.managedbuilder.core/debug/builder=true
org.eclipse.cdt.managedbuilder.core/debug=true
org.eclipse.cdt.managedbuilder.core/debug/pathEntryInit=false
org.eclipse.cdt.managedbuilder.core/debug/pathEntry=false
And run Eclipse with the additional switches:
-debug <trace_options>.file
This will echo trace prints to the shell in which you started Eclipse. You can use this to better target the bug report you'll no doubt file :)
Try to uncheck the Build Automatically checkbox, under Project menu.

Eclipse adding your own build command

I am new to eclipse and wanted to do the following:
Use my custom build commands with eclipse. Until now I only saw make all. I use a shell script for building my project; how can I use that in an Eclipse environment?
When I create a new project with the existing source code, it doesn't add the files, without building the code and if code fails to build (because I generally don't have make all).
How do I resolve this issue?
You can add a custom builder in the "Builders" category of the project properties.
project->properties->builders->new
there you can also deactivate the default eclipse builders..
hope that helped
In addition to what smeg4brains said and assuming that you are using the CDT plugin you can go to:
project -> properties -> C/C++ Build
Uncheck Use default build command on the Builder Settings tab and replace make with e.g. scons.
On the Behaviour tab you can then specify the target to call for the Build and Clean phase.
To resolve your second issue open the Project menu and uncheck Build automatically.
This will prevent Eclipse from building the project when it thinks it is necessary.
If you want to add other your own commands then the easiest way is to write Ant file for your project so by clicking once you can execute all your commands.To see how to write Ant file click here
I was able to do something similar to have protoc run on my .proto files. I did it by adding a "Make Target" to the project.
A lot of stuff in Eclipse you can get around using Ant, which are XML scripts, and there is also a ANT project builder which uses those. If you don't like to mess with frankly quite touchy GUI options, just write a build.xml and use ANT build as the project builder.

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?