Skip to Content
author's profile photo Former Member
Former Member

Wrong jar loaded when executing unit test via ant target

Hybris Version: 4.7

I would like to use a newer version of mockito in my extension. I have added the newer jar to my extensions "lib" folder and adjusted the classpath accordingly in ee. If I run my unit-tests within the IDE, everything works fine. But if i start the tests via ant unittest, the old version of the jar in platform/ext/core/lib loads and the test fails to start.

How can I set the correct classpath for the ant target?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jul 25, 2014 at 09:55 AM


    in general it is problematic. You would have to replace the lib that is shipped with the platform to a version with which all the tests using mockito are compatible. Having 2 versions seems impossible (classloader issues) and may lead to isses between environments, even if you will manage to run it on your machine.

    Cheers, Wojtek

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 25, 2014 at 10:47 AM

    Just grep for mockito in your extracted platform directory. You should delete all old versions with your build file after extracting the platform. (Or delete it once if you don't extract the platform on a clean build.) Afterwards the classloader should only find your new version in your extension.

    Btw. if you still have trouble with classloader you might want to check the other extension or start your jvm with -verbose:class to see where your classes are loaded from.
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.