I'm setting up an Eclipse autobuilder to run the closure template compiler. I've already got an ant task setup and running automatically whenever any file changes. How can I set it up so that it only runs when I change a *.soy file?
I see that I can use a directory as a set of "relevant files," but my *.soy files may be scattered throughout the whole project.
You cannot do this with the Ant based builder. Instead you would need to implement your own incremental builder, extending the extension point org.eclipse.core.resources.builders. But as that would be a huge effort, the more efficient workaround might be to just filter in the Ant script itself.
Related
I'm trying to setup a key binding in Eclipse to directly execute a background Java file. My file is called CodeChecker.java and it's sufficient for my purposes to run the main method without any arguments. I need to run it repeatedly and so I'm trying to setup a shortcut key to run it directly without having to bring up the Run... menu or having to bring up the file itself.
As far as I'm aware Eclipse is not able to offer this functionality directly. I've tried using a plugin called Practically Macro according to this answer Assigning a keyboard shortcut for a specific Eclipse build configuration. But this answer is horribly out of date and doesn't work any longer.
So I'm wondering if Practically Macro can still be used to achieve this? Any other solution, plugin, script or otherwise would be equally welcome.
I'd like to run an external beautifier over my code that's open and replace the contents of the document with the output. Is there a plugin or something I can exploit to do this? I thought it would be a no-brainer under the formatter preferences, but it looks like you can only use internal templates.
One solution is the following:
Create an ant builder on your project. See this article about how to do that. The important things you should know after you read the article:
Add a new ant builder by right click on project and properties. See the implicit variables your ant script will have. The variables will contain one or more resource name and path. So be prepared for collections.
Filter the resouces in the "Build
options" tab. This is important,
since launching a JVM (or a new task
inside IDE JVM) for the change of
every file (filetype) is not so
fast. So filter resources to be
processed like this:
The third thing is to ask eclipse to refresh the resource after the script is run. Like this:
Set the target of the ant script to be run as automatic build (third option). You can set all the four anyway it will be ok:
Write your script. You will find the log of the ant script in console, and you may redirect the log into a file as well. You can see the option on the second picture. Start your script with an echoproperties tag to see what your script gets from eclipse.
I used such builders a lot, it works like it should. I like them. Good luck. Consider accepting your answers, 42 % is not too much :D
I need to copy a file after saving it to another directory - how can I achieve this? My first attempt is to use an ant builder that always (after a clean, after a build ...) copies all files of my project to the target directory. This works fine but if you have 1000 and more of files in your project, it gets to slow. So I just want to automatically copy the file that I've just edited/created to a specific directory.
http://andrei.gmxhome.de/filesync/index.html
This is a filesync plugin for eclipse. Pretty fast and incremental. I always use it for such cases. You define mapping, and it is a native (java) builder, that is assigned to your project. Works with path variables as well, if you need to achieve workstation independent settings.
ps:
What do you use it for? Since I recently used it, but I realized, this is usually evil thing :) Do you tell me the use-case for this?
I've got an Eclipse (Galileo) project (called ProguardBuilder) that runs Proguard over a set of class files in other projects and produces a jar file.
I'd like to have the ProguardBuilder project get rebuilt any time any class file in the other projects changes. AutoBuild doesn't do that; presumably it's smart enough to recognize and ignore any changes that don't affect anything externally visible.
My problem is that I don't care whether or not the change is visible, since I need to completely rebuild ProguardBuilder any time the class files it depends on change at all.
How do I tell Eclipse to do this sort of rebuild?
You might have to use an external builder. Check the documentation, because I've never done this. But the place to start is the "Builders" section of the project properties dialogue.
I have recently come across the LESS Leaner CSS a template engine for CSS based on ruby. The idea sounded neat, but in practice we need to compile the program to get CSS. This is cumbersome as we make too many changes while working on CSS and for every edit we don't want to compile.
In Eclipse, there are "Save-Actions" but it handles only formatting changes.
Is there a way on saving the file in Eclipse, to call or trigger the compilation?
Its easy to do this in Vi or Emacs.
I think all you need is to define a custom Builder for your project. That way, you can run a program or an ant script whenever certain files change.
Right click on the project -> Properties -> Builders -> New
While the Builders are a good solution, keep in mind they only work when a build is issued - either using auto-build or using a manual build which is invoked, well, manually. If you are looking for something that will operate after a save, regardless of the auto-build state you will need to write a plugin which listens to resource changes in Eclipse.
You do that by creating a workspace change listener and installing it like that:
ResourcesPlugin.getWorkspace().addResourceChangeListener(
..., IResourceChangeEvent.POST_CHANGE);
I'm sure you can take it from here :-)