title: Migration to JDK11 changes how tests must be run from Maven
body: <p>I'm upgrading my code from Java v1.8 to v11.0.8. All went fine until I run the tests <code>mvn test</code> and Mockito starts having issues. Every test errors-out.
  My versions of Mockito are fine (2.23.4) <a href="https://stackoverflow.com/questions/52533878/mockito-error-in-spring-boot-tests-after-migrating-to-jdk-11">according to other answers here</a> so I go to run just 1 test to narrow down the problem - it runs fine. So I run all the tests by right-clicking in Eclipse on my src/test/java and choosing Run As &gt; JUnit test. Again, all run fine.</p>
  <p><strong>Note:</strong> I hesitate to add the error message here because the code works (as noted above), so this can be a distraction, but this question got a close request for lack of error message!</p>
  <pre><code>You are seeing this disclaimer because Mockito is configured to create inlined mocks.
  You can learn more about inline mocks and their limitations under #39 of the Mockito class javadoc
  Underlying exception: org.mockito.exceptions.base.MockitoException: Could not modify all classes [..., ..., ...]
  at ...
  at ...
  Caused by org.springframework.beans.BeanInstantiationException: Failed to instantiate [..]: Factory method '...' threw exception; nested exception is org.springframework.beans.BeanCreationException: Error creating bean with name '...' defined in...
  Mockito cannot mock this class: ...
  
  If you're not sure why you're getting this error, please report to the mailing list.
  </code></pre>
  <p>The app itself runs fine with <code>springboot:run clean</code></p>
  <p>My tests always ran with only <code>test</code> as the goal, that is <a href="https://spring.io/guides/gs/testing-web/" rel="nofollow noreferrer">confirmed for me here</a>, so what's changed?</p>
  <p>I also see references to: Bytebuddy in that article but I have a good version of that too (1.9.16)</p>