Posts Tagged ‘eclipse’

Excluding resources and test classes from war/ear in Eclipse

Monday, August 24th, 2009

Today I was trying to figure out how to exclude certain resources/classes from the war that was being deployed to my embedded server in Eclipse. I couldn’t find out how to do this in the Eclipse settings file.

Apparently, it has nothing to do with the source folder you see in the Project Explorer view, or the export settings in the Buildpath dialogs: instead you need to edit the Eclipse settings file “project-war\.settings\org.eclipse.wst.common.component” (viewable in the Navigator view) and modify the deployed source folders in there. Changes there do *not* reflect in the Project explorer (at least not with my version of Eclipse, Galileo). I’ve removed the test sourcefolder from there and everything was honky dory.

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
  <wb-module deploy-name="foo-war">
    <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
    <property name="context-root" value="foo"/>
    <property name="java-output-path"/>
  </wb-module>
</project-modules>

trackback

Repost: Make Eclipse ignore .svn directories

Tuesday, August 11th, 2009

Eclipse has the annoying little problem where Eclipse will copy .svn folders to the target/classes output folder and then complain about duplicate resources. After wading through some vague solutions, here’s a clear and simple post I found to solve this annoyance.

Make Eclipse ignore .svn directories

Window -> Preferences…, Java -> Compiler -> Building. Under “Output folder” add “, .svn/” to “Filtered Resources” (so that you get “*.launch, .svn/”).

It still works like a charm. Thanks Brian.

trackback

Fix Eclipse @author under any account

Monday, June 30th, 2008

Here’s a quick tip I found very useful in Windows, involving Eclipse template system and the @Author annotation.

Say you are working under some kind of account, for example some assigned number combination which you use to log into Windows or something. Mine recently was AA170738. Now say you are editing Java classes in Eclipse and generating comments with Eclipse. You might end up with something like this:

/**
 * @author AA170738
 *
 */

I Found this very annoying since it happened to me for every class I introduced and templates are supposed to save time. You could ofcourse turn it off entirely, Preferences->Java->Editor->Templates->uncheck @author, but I just wanted it fixed the right way.

Turns out Eclipse simply reads out the Java system property user.name. All we need to do then is boot Eclipse with an explicit system property. Like so…

eclipse.exe -vmargs -Duser.name=”John Doe”

Just change that in your shortcut and you’re set.

/**
 * @author John Doe
 *
 */

Slashdot Slashdot It! / trackback

Add to Technorati Favorites