From d0d1194ddcfa340351c5193eb9fc57492877cedb Mon Sep 17 00:00:00 2001 From: Phillipus Date: Wed, 18 Dec 2024 15:34:12 +0000 Subject: [PATCH] Add support for Mockito/ByteBuddy requiring javaagent on Java 21 - See https://github.com/mockito/mockito/issues/3037 - See https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3 - Requires Mockito 5.14.0 or later which allows you to specify Mockito itself as an agent rather than ByteBuddy - Note - all test plug-ins need to declare a dependency on Mockito so that the mockito jar property ${org.mockito:mockito-core:jar} is always resolved for each test run - To run JUnit in Eclipse you need to add the following VM arguments (adjust path version as required): -Xshare:off -javaagent:${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.mockito.mockito-core_5.14.2.jar - Or, for now, it's simpler to add the following VM arguments: -Xshare:off -XX:+EnableDynamicAgentLoading --- .github/workflows/tests.yml | 2 +- com.archimatetool.editor.product/archi.target | 4 ++-- tests/pom.xml | 21 +++++++++++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39d4741fe..e7e6eb1e1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' cache: 'maven' diff --git a/com.archimatetool.editor.product/archi.target b/com.archimatetool.editor.product/archi.target index e301a7b4b..02b8ff379 100644 --- a/com.archimatetool.editor.product/archi.target +++ b/com.archimatetool.editor.product/archi.target @@ -10,8 +10,8 @@ - - + + \ No newline at end of file diff --git a/tests/pom.xml b/tests/pom.xml index 88b403c4f..775dcd2a8 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -14,9 +14,8 @@ pom - - - -Xshare:off + + -Xshare:off -javaagent:${org.mockito:mockito-core:jar} ${mockito.args} @@ -27,7 +26,7 @@ Orbit p2 - https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.32.0 + https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.34.0 @@ -52,6 +51,20 @@ + + + org.apache.maven.plugins + maven-dependency-plugin + 3.8.1 + + + + properties + + + + + org.eclipse.tycho tycho-surefire-plugin