How to automatically format drools files with Eclipse? - eclipse

For our current project we have code formatting rules for java and xml files. Is there some way to configure Eclipse to format drools files (*.drl)?

As far as I know you can't. The current plugin doesn't format the DRL files. It can be a very good contribution to the project :)
Cheers

Related

How to convert Eclipse template file to IntelliJ template file

How can I convert Eclipse template file to IntelliJ template file. I do not want to add plugin to use the Eclipse file. I want to convert it.
Though not strictly respecting your question (no plugin), the built-in plugin Eclipse integration of IDEA 13 can import Eclipse templates quite accurately:
http://blog.jetbrains.com/idea/2014/01/intellij-idea-13-importing-code-formatter-settings-from-eclipse/
As stated in that post, the result cannot be 100% accurate as IDEA does not support all of the template options present in Eclipse (and the opposite might be true too).

Have eclipse copy .class files to additional target folder?

I have an eclipse project. By default, my .class files are being put here:
/projectname/build/classes
is there a way I can have eclipse also copy those files to an additional folder destination, every time the project is built?
I could write a script to do this myself, but was hoping there was some kind of hook in eclipse to do this.
Thanks
You could write an Ant script for this and add it as a builder to your project. See the Eclipse documentation for an example.
Eclipse doesn't have the native ability to output to multiple locations, but you can probably accomplish it yourself by adding a custom builder to your project(s).

Configure Eclipse Formatter with m2e

is there any existing m2e-extension to configure Eclipse Formatter when importing a Maven project into eclipse?
We are using custom checkstyle rules and m2eclipse configures the Eclipse-CS-plugin for us. But in addition I want the Eclipse Formatter to be configured as well...
This Eclipse plugin may be of use (https://github.com/SciSysUK/m2eclipse-maveneclipse).
One thing you can do with it is copy files around, for example copy the prefs files for the formatter into the Eclipse .settings folder. It isn't perfect but it does the job (I would be really interested in a better/alternative way of achieving this).
There is an example here: https://github.com/philwebb/springfaces/blob/master/springfaces/pom.xml.
Note you can also use a URL so you can host those files somewhere

Is there way to tell IntelliJ IDEA which output folder to use for GWT compiler?

Is there way to tell IntelliJ IDEA which output folder to use for GWT compiler ? I know it copies artifacts to project folder but it doesn't copy extras which I set using "-extra" command line parameter of gwt compiler.
IntelliJ IDEA leaves it in USER_HOME/.IntelliJIdea10/system/gwt/project_name_with_hash/module_name_with_hash/compile/www
UPDATE: Strangely I didn't find list of possible path macroses on IntelliJ's website. But I found them in idea.jar. Possible macroses are:
APPLICATION_HOME_DIR
PROJECT_DIR
MODULE_DIR
USER_HOME
Have you tried constructing the path using ${PROJECT_DIR} path variable? That will resolve to the project location and then you can specify the rest of the path. Like ${PROJECT_DIR}/reports/extras. I haven't used IntelliJ for a few years, but I am pretty sure that's the path variable name.
EDIT: sorry built in path macros in IntelliJ are specified using $...$ syntax. So I think it should be $PROJECT_DIR$
There is no way to change output folder for GWT compiler in IDEA. However you can specify absolute path to any directory after '-extra' parameter.
By the way for what purpose do you use '-extra'?
As of November 18, 2011 it is impossible to use path macroses in settings of project modules. Jetbrain is aware of this and there is feature request in their JIRA.
My work-around for a team with multiple engineers for now is to use system TEMP folder for GWT compiler extra output and move files in post-build event to folder I want it to be at.

Add raw .groovy file to output dir in Eclipse with Groovy Plugin

I'm using Eclipse and I have the Groovy Plugin installed.
From within a standard Java project I want to include a file with a .groovy extension on the runtime classpath. I have a source folder (src/main/resources) which includes all files and has no exclusion filters. Inside that directory I have 2 files: foo.groovy and foo.txt. When I clean and rebuild the project from eclipse and look in the output directory I see foo.txt, but foo.groovy is nowhere to be found.
Does anyone know if it's possible to have Eclipse treat a file with a .groovy extension like any other resource file while still having the Groovy plugin installed and having other Groovy projects in the same workspace?
In case you are wondering, I'm trying to get logback configured using a groovy script. If there's some other way to accomplish this please let me know.
There is a new feature in Groovy-Eclipse 2.1.0 that allows you to specify script folders. These folders contain groovy files that are not compiled and are optionally copied to the output folder. src/main/resources is a script folder by default.
To enable this, install 2.1.0 (or later) and go to preferences -> Groovy -> compiler.
I ran into the same thing a few years ago. The Groovy plugin treats .groovy files as source files. The same way a .java files do not get put into the output directory, neither do .groovy files. At the time I could not find a way around this. I don't know if there is a way around it but I did come up with a workaround.
I used the extension .g for groovy files that I wanted to keep as scripts and have them interpreted at runtime. These would be skipped by the groovy compiler and would end up in the output directory. Also doing things this way allows you to mix compiled groovy (.groovy) and runtime interpreted groovy files (.g).
** EDIT **
See comment from #Andrew Eisenberg. This answer was correct when this question was originally asked. His answer is correct going forward since there is a new version of the eclipse plugin.