Archive for November, 2008

How to add sources to Eclipse/Idea project generated by Maven

Friday, November 21st, 2008

Wanted to have a link here, since it takes me a while to find it:

I’ve released configuration manager 1.6

Friday, November 21st, 2008

Configuration Manager 1.6 provides easy API for integrating it into your code (literally 2 lines and a small xml file), and easy Unit testing of the code that is dependent on configuration manager. Visit for more details.

Maven – fixing classpath issues for tests

Monday, November 10th, 2008

We had problems with tests not finding files that we usually package outside the jar. One of such files was log4j.xml and other files were configuration files for spring framework. We need to pass full path to the log4j file, so that we don’t have to rely on class path priorities to look it up. Given that log4j.xml is such a widely used file, it is probable that one of the dependent jar would have a copy in the archive – so we can pick up the wrong file by mistake. On the other hand, we want to have our spring framework configuration files in the class path, but outside the jar. This way we can modify the configuration on the fly if we need to. So to setup integration test case, we needed to get the full path to the log4j.xml file and adding a directory to the class path for test only.
Here is how to do that:
public static String getFullPath(Class c, String name){
     ClassLoader cl = c.getClassLoader();
     URL url = cl.getResource(name);
     return url != null ? url.getPath() : null;
and for adding class path: