Following on from this question, I now want to know how to stop an ANT script from executing if the preceding build failed. I can't see a way in the Build setup in Eclipse of chaining builds together based on their success.
I think I am lookikng for either a way to pass the previous build status into my ANT script so I can terminate or to never call the ANT script at all if the first build fails.
Any ideas?
No native way, AFAIK.
What you can do is modify your ant script to check if .class files produced by Eclipse are newer than WAR. If not, stop.
You should be able to store the success into a file. If you make sure the content of the file is a property file content the next ant task can use that file to fill in a property (like build.success) and can act on that.
Related
I am developing C/C++ code in Eclipse. Does anyone know if there is a way (perhaps some pre-defined variable) that would let me know during the pre-build step (to be passed to a pre-build script) if a build will be required (i.e. if the project has changed)?
I am writing a script to automatically update a version number but only want it to do so if there have been changes.
Thanks!
You can add a builder which does the task instead of putting it in a pre-build step. This version incrementing builder has its own dependencies (which can be the the complete project or an interface folder if you want to limit the scope of changes) and is thus executed only if there is a demand for a new version.
I am trying to automatically copy files after the "dist" directory has been created and populated. The provided ant targets "-post-jar" and "-post-compile" seem to run before the dist directory is created. I can't find the actual build target in the build-impl.xml file. So I was going to attempt to put the command directly in build-impl.xml but can't seem to determine the correct target.
edit: -post-jar does work, however I am still curious what target is called.
The Clean & Build calls the following ant targets:
clean
deps-jar
Edit Ant settings to run build with verbose mode and you get get better insights into what targets are executed and when. build-impl.xml probably includes another build files from NetBeans installation where you can find all the details (some targets are defined through macros and it is not very readable).
I want to have FDT loop through a list (or directory) of .AS files and output corresponding .SWFs.
I want to do this via Ant, instead of using FDT's launcher chain, and found the 'fdt.launch.application' Ant task in the documentation here. Can I use it to help me?
Not directly, you can simulate loops with Ant by using the 'for' or 'foreach' Ant tasks. But you'll need to first install the tasks, which do not ship with Ant by default. See here for more info on getting those tasks.
You can then define the files and outputs to compile in a separate properties file - which perhaps you can also generate via Ant or just edit by hand. In the above link, the answer shows how to work with an external properties file.
When you do that you'll need to include the fdt <fdt.launch.application> compile task in your loop and use the variables you extract from the properties file.
I have a project in eclipse right now that is compiled using ant. I am wondering what eclipse is doing behind the curtains whenever I double click on the jar target of one of this build files.
Is it possible to get the commands that eclipse is executing with ant, as I'd like to setup a shell script that compiles the project. How can I find what commands it is actually executing and what parameters it is passing.
I imagine there are also some variables like classpath, and buildpath that are set, where do I find them as to be easily copied over.
Eclipse comes with its own installation of ant. Is it possible to use that bundled installation of ant to build via command line.
Any help appreciated,
Ted.
One possible way is to look at the process executed by Eclipse when building.
For that, use Process Explorer (if you are on Windows) in order to display the full command line and all its parameter when running that build.
I've set an external tool (sablecc) in eclipse (3.4) that generates a bunch of classes in the current project. I need to run this tool and regenerate these classes fairly frequently. This means that every time I want to run sablecc, I have to manually delete the packages/classes that sablecc creates in order to ensure that I don't have conflicts between the old and new generated classes. Is there some easy way to automate this from within eclipse or otherwise?
Not sure if I understand your point right, I suppose you need to delete old classes before running sablecc because some of them would not be eventually created in new run.
It is probably best to write short Ant build.xml with the target, which first removes the classes (Ant delete task) and then runs sablecc (Ant exec task). It is also possible to preset eclipse so that it refreshes workspace after Ant finishes.
Put the build.xml anywhere to project, right click, Run As/Ant Build.
Just for the sake of the clean style, you could then call sablecc with its Ant task (implemented by org.sablecc.ant.taskdef), instead of running it externally in new process.
You can tell Eclipse to refresh the workspace (or parts of it) after an external tool has been run. This should force Eclipse to detect any new/deleted classes.
JesperE is referring to the option Refresh->Refresh resources on completion in your external tools configuration for running sablecc.