3

My eclipse seems not to be able to resolve JUnit 5 types when I write a test in a Java 9 module:

enter image description here

"Test cannot be resolved to a type"

I manually have added the JUnit 5 Library to the projects buildpath. Also I did these "clean project" and "update eclipse from pom.xml" kind of things.

When I build this project with the embedded Maven there is no problem, the test is compiled and executed.

Is it an eclipse bug in conjunction with java 9 modules or how do i have to configure eclipse correctly?

Configuration:

  • eclipse Oxygen.2
  • JDK 9.0.1
coder
  • 1,415
  • 2
  • 12
  • 15
  • As Java 9 brings more options, we'd need to know more about your project: In your module, do you "requires" junit5? By what name? Is JUnit on the classpath or on the modulepath? – Stephan Herrmann Dec 27 '17 at 10:06
  • I don't want a requires of junit, assertj, etc. in modules. I see https://bugs.eclipse.org/bugs/show_bug.cgi?id=520713, so work is in progress. I'll wait (in joyful anticipation) for the next Eclipse version. – coder Dec 30 '17 at 11:51
  • Yes, bug 520713 is the space to watch. – Stephan Herrmann Dec 30 '17 at 18:05

1 Answers1

2

There are some issues related to Java9 and Junit5 here https://github.com/junit-team/junit5/issues/425

A way out of this is using the support for Oxygen:

https://marketplace.eclipse.org/content/junit-5-support-oxygen

developer_hatch
  • 15,898
  • 3
  • 42
  • 75
  • Note that the linked market place entry is not longer used for installation, it says "JUnit 5 support is now available with Eclipse Oxygen.1a (4.7.1a)". Meanwhile Oxygen.2 is out with some bug fixes in that area, but as the OP explicitly mentions Oxygen.2, this is not the problem here. – Stephan Herrmann Dec 27 '17 at 10:04