-
Task
-
Resolution: Unresolved
-
L3 - Default
-
None
-
None
-
None
-
None
Problem
Webjar resources in surefire tests are only available with useManifestOnlyJar disabled
Reasoning
- Currently, we use surefire to run unit tests in the platform repo and others
- When running a jar on the JVM, the classpath can be defined as a command-line argument; However, surefire has some strategies [1] to work around a command line length limit on Windows systems
- One of those strategies is useManifestOnlyJar
- Maven creates a single jar containing a MANIFEST.MF in which all jars that should be included on the classpath are defined
- Spring Boot relies on URLClassLoader#getURLs to register static resources (see StaticResourceJars#getUrls) which only returns surefire's Manifest-Only Jar but not the jars referenced in the manifest file itself (due to a bug [2] in the JVM)
- The problem does not exist when using a JVM version >= Java 9 [3] since the system class loader changed from URLClassLoader to java.base/jdk.internal.loader.ClassLoaders$AppClassLoader
Solutions
To not run into the problem again, we could consider disabling useManifestOnlyJar project-wide; Disabling should be safe since the length limitations for Windows were fixed by using the environment variable CLASSPATH on Windows systems starting with surefire 2.8.2 [4]
[1] https://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html
[2] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8168647
[3] https://blog.codefx.org/java/java-9-migration-guide/#Casting-To-URL-Class-Loader
[4] https://github.com/apache/maven-surefire/commit/d6e6a8
This is the controller panel for Smart Panels app
- is related to
-
CAM-11373 In Spring Boot & Camunda Run, application path of webapps is set to /camunda
- Closed