Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Hamcrest conflict with JUnit runner - signed/unsigned jars(older OSGI signed hamcrest jar conflicts with unsigned project classpath jar)
Hamcrest conflict with JUnit runner - signed/unsigned jars [message #1125633] Fri, 04 October 2013 14:26
David Biesack is currently offline David Biesack
Messages: 9
Registered: July 2009
Junior Member
I'm getting an error running JUnit 4 tests in Eclipse:

java.lang.SecurityException: class "org.hamcrest.TypeSafeMatcher"'s signer information does not match signer information of other classes in the same package

This was discussed on Hamcrest issue 128

It seems that Eclipse' use of the internal JUnit and Hamcrest 1.1 jars, which are signed OSGI bundles, conflicts with projects which use Hamcrest.

That issue suggests moving the Hamcrest jars before Junit in the project's libraries. However, I'm using Maven (m2e) and even though my pom.xml lists Hamcrest before Junit,

       <dependency>
         <groupId>org.hamcrest</groupId>
         <artifactId>hamcrest-library</artifactId>
         <version>1.3</version>
      </dependency>
      <dependency> 
          <groupId>org.hamcrest</groupId>
          <artifactId>hamcrest-all</artifactId>
          <version>1.3</version>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.11</version>
      </dependency>


I still get this error when I run the unit tests in Eclipse. Running 'mvn test' outside of Eclipse runs without error because Maven only resolves to the 1.3 jars which are not signed.

Any fixes?

I'm running Spring Tool Suite (STS):
Version: 3.3.0.RELEASE
Build Id: 201307092139
Previous Topic:Referring to fonts in Java on openSUSE 12.3
Next Topic:Content assist in Eclipse Kepler unreliable.
Goto Forum:
  


Current Time: Mon Oct 07 06:07:18 EDT 2013

Powered by FUDForum. Page generated in 0.01492 seconds