We have a fairly involved (~40 sub-projects) Java + one npm project build that runs all the way through various compile, jar, war, “installer” uber jar, and copy to deployment folder steps, reports success, but then fails on an internal Gradle call. It fails on both development laptops (Windows 7) and under Jenkins (CentOS 7).
I have tried to reproduce in a smaller build but no success; tried to consolidate all the dependencies on commons-io to one version (2.6) which is also the one used in the 5.6.3 lib by Gradle; still, no luck. The only work around I have now is to run the npm/angular application build separately, then the rest, which seems to always work. It’s odd because the npm/angular build has no reference to commons-io; it’s all Javascript.
I didn’t want to file a bug without a reproducing test case, but still thought I would ask if anyone has some advice about this class loader violation type issue, as I’ve seen some other bug reports around it with regard to plugins and buildscript dependencies.
Thanks, John
Summary
BUILD SUCCESSFUL in 24m 31s
381 actionable tasks: 378 executed, 3 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
loader constraint violation: loader (instance of org/gradle/internal/classloader/VisitableURLClassLoader) previously initiated loading for a different type with name "org/apache/commons/io/filefilter/IOFileFilter"
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
java.lang.LinkageError: loader constraint violation: loader (instance of org/gradle/internal/classloader/VisitableURLClassLoader) previously initiated loading for a different type with name "org/apache/commons/io/filefilter/IOFileFilter"
at org.gradle.cache.internal.VersionSpecificCacheDirectoryScanner.listVersionSpecificCacheDirs(VersionSpecificCacheDirectoryScanner.java:62)
at org.gradle.cache.internal.VersionSpecificCacheDirectoryScanner.getExistingDirectories(VersionSpecificCacheDirectoryScanner.java:52)
at org.gradle.cache.internal.VersionSpecificCacheCleanupAction.scanForVersionSpecificCacheDirs(VersionSpecificCacheCleanupAction.java:110)
at org.gradle.cache.internal.VersionSpecificCacheCleanupAction.performCleanup(VersionSpecificCacheCleanupAction.java:101)
at org.gradle.cache.internal.VersionSpecificCacheCleanupAction.execute(VersionSpecificCacheCleanupAction.java:73)
at org.gradle.initialization.layout.ProjectCacheDir.stop(ProjectCacheDir.java:49)
at ...