0

I am using IntelliJ to build a spring boot project in Java 9. But I'm getting Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException whenever i use @SpringBootTest or @DataJpaTest.

Following this post I added --add-modules=java.xml.bind in the Run Configuration - VM options which fixed the problem but only for that Run Configuration on which I added it.

Now i have multiple Test Classes that make use of @SpringBootTest or @DataJpaTest and if I manually go and add the --add-modules=java.xml.bind to each Run Configuration, each on works individually but when i try to for example

src/test/java -> right click and Run Tests (on the whole test suite)

  • it doesn't consider those individual Run Configuration and hence fails for those tests,

Is there any option to add the VM options - so that they are considered during integration test runs.

RangerReturn
  • 171
  • 3
  • 3
  • 18

1 Answers1

0

So this finally worked for me

Use case: selecting the whole src/test/java package by right clicking - and being able to run all tests

In IntelliJ

  1. Create a new run configuration of JUnit
  2. There you will see an option - Test Kind - select All in package
  3. then choose Search for Tests in whole project
  4. and then define your vm options sample

Note: this is for my use case , i still need to define this vm option if i want to run tests individually, but i think it can also be configured in Maven Surefire plugin. But for now this solved my problem.

RangerReturn
  • 171
  • 3
  • 3
  • 18