Tuesday, March 13, 2012

Resolving runtime JUnit issues when Eclipse builds your JUnit project flawlessly

Currently I'm writing automation using JUnit to test REST endpoints.

I'm using Eclipse Iridium with Perforce and Maven as plugins. Eclipse builds my automation project just fine and I can also build successfully on the command line too using Maven (e.g. mvn -Dmaven.test.skip=true clean install).

When I launched my JUnit class I was getting a method not found error. After some exploring through Google I found a very handy Java method call to resolve my runtime dependencies and see what JAR file Java and/or Maven were using.

The method I used was:

System.out.println(Base64.class.getProtectionDomain().getCodeSource().getLocation());

The link to the original article is here.

It seemed under my .m2 directory a prior version of apache commons was being used during runtime (1.2 versus 1.5).

As a temporary stopgap measure I copied the 1.5 JAR file into the 1.2 Maven repository and I got my runtime working.

No comments:

Exploring ELK (Elastic) Stack for hack-a-thon

At my current gig, our group finally got to do hack-a-thon week and I joined a team project that tied together a few of the technologies I&#...