2008-03-06

Marking target as derived

From this post on the maven-users mailing list comes the following script, lightly edited to work with the current version of Monkey:

--- Came wiffling through the eclipsey wood ---
/*
* Menu: Maven > Make Maven Targets Derived
* Kudos: Donnchadh Ó Donnabháin
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
*/

function main() {
var files = resources.filesMatching(".*/pom\\.xml");
var targetFolder;

for each( file in files ) {
if (targetFolder = file.eclipseObject.parent.findMember("target")) {
targetFolder.setDerived(true);
}
}
}
--- And burbled as it ran! ---
You will of course need Monkey installed, point Eclipse at http://download.eclipse.org/technology/dash/update/. Then copy the above script (including the funky separator lines) and select the Scripts->Paste New Script menu item.

Why would you want to do this? Well, if you (like me) are tired of Eclipse suggesting stuff in the target directory when you do "Open Resource", this is for you.

No comments: