allegro / axion-release-plugin

Gradle release & version management plugin.
https://axion-release-plugin.readthedocs.io/
Apache License 2.0
566 stars 155 forks source link

Error running Gradle unit tests with axion 1.13.4+: java.util.ServiceConfigurationError: java.nio.file.spi.FileSystemProvider: Provider org.apache.sshd.common.file.root.RootedFileSystemProvider not found #459

Closed cloudshiftchris closed 2 years ago

cloudshiftchris commented 2 years ago

...in some cases the error is "Circular loading of installed providers detected" due to Groovy having a try/finally that attempts to reload filesystems when the previous attempt has failed (due to the fs not found error in the subject).

Perhaps related to the shading adjustments in 1.13.4 (#412), as the axion JAR contains META-INF/services/java.nio.file.spi.FileSystemProvider with an incorrect value of "org.apache.sshd.common.file.root.RootedFileSystemProvider" (the shaded value is "axion.org.apache.sshd.common.file.root.RootedFileSystemProvider"

In build.gradle.kts the 'shadowJar' task is missing "mergeServiceFiles()" to adjust service files accordingly. This was not there previously for the 'shadow' prefix - possibly this worked due to an elsewhere-shadowed library being grabbed (alternately, other code changes could now be triggering the loading of this FS provider. edit: confirmed, this FS provider was not present prior to 1.13.4).

415 is related as well - the presence of dependencies was masking this issue, with their removal it's a gamble as to whether a dependency is present at all (or at the desired version).

cc @kkocel

cloudshiftchris commented 2 years ago

There are other service files present that also have incorrect references.

This is messy - many of the shaded libraries simply aren't used, relying instead on coincidence that required libs are elsewhere provided, defeating the goal of shading.

Likely many quirky defects resulting from this.

cloudshiftchris commented 2 years ago

The interaction here is with JUnit temporary dirs and Gradle ProjectBuilder; here's a Kotlin snippet, it's the use of ProjectBuilder that is the start of the failing stack trace.

internal abstract class AbstractTest {

    @BeforeEach
    fun beforeEach(@TempDir tempDir: File) {
        project = ProjectBuilder.builder()
        .withName("Test project")
        .withProjectDir(tempDir)
        .build()
    }
}
installedProviders:213, FileSystemProvider (java.nio.file.spi)
newFileSystem:334, FileSystems (java.nio.file)
newFileSystem:286, FileSystems (java.nio.file)
newFileSystem:161, ClassFinder (org.codehaus.groovy.vmplugin.v9)
find:118, ClassFinder (org.codehaus.groovy.vmplugin.v9)
find:107, ClassFinder (org.codehaus.groovy.vmplugin.v9)
doFindClasses:109, Java9 (org.codehaus.groovy.vmplugin.v9)
getDefaultImportClasses:88, Java9 (org.codehaus.groovy.vmplugin.v9)
<clinit>:648, ResolveVisitor (org.codehaus.groovy.control)
<clinit>:809, InvokerHelper (org.codehaus.groovy.runtime)
getDefaultMetaClass:46, GroovyObjectSupport (groovy.lang)
<init>:32, GroovyObjectSupport (groovy.lang)
<init>:29, DefaultExtraPropertiesExtension (org.gradle.internal.extensibility)
<init>:49, DefaultConvention (org.gradle.internal.extensibility)
<init>:56, ExtensibleDynamicObject (org.gradle.internal.extensibility)
<init>:248, DefaultProject (org.gradle.api.internal.project)
<init>:-1, DefaultProject_Decorated (org.gradle.api.internal.project)
newInstance0:-1, NativeConstructorAccessorImpl (jdk.internal.reflect)
newInstance:62, NativeConstructorAccessorImpl (jdk.internal.reflect)
newInstance:45, DelegatingConstructorAccessorImpl (jdk.internal.reflect)
newInstance:490, Constructor (java.lang.reflect)
newInstance:2078, AsmBackedClassGenerator$InvokeConstructorStrategy (org.gradle.internal.instantiation.generator)
newInstance:488, AbstractClassGenerator$GeneratedClassImpl$GeneratedConstructorImpl (org.gradle.internal.instantiation.generator)
doCreate:64, DependencyInjectingInstantiator (org.gradle.internal.instantiation.generator)
newInstance:55, DependencyInjectingInstantiator (org.gradle.internal.instantiation.generator)
createProject:49, ProjectFactory (org.gradle.api.internal.project)
createMutableModel:306, DefaultProjectStateRegistry$ProjectStateImpl (org.gradle.api.internal.project)
createProject:137, ProjectBuilderImpl (org.gradle.testfixtures.internal)
build:120, ProjectBuilder (org.gradle.testfixtures)
project:11, ProjectFixtures (cloudshift.gradle.plugin.compare.fixture)
beforeEach:26, AbstractTest (cloudshift.gradle.plugin.compare.comparator)
invoke0:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:62, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:43, DelegatingMethodAccessorImpl (jdk.internal.reflect)
invoke:566, Method (java.lang.reflect)
invokeMethod:725, ReflectionUtils (org.junit.platform.commons.util)
proceed:60, MethodInvocation (org.junit.jupiter.engine.execution)
proceed:131, InvocationInterceptorChain$ValidatingInvocation (org.junit.jupiter.engine.execution)
intercept:149, TimeoutExtension (org.junit.jupiter.engine.extension)
interceptLifecycleMethod:126, TimeoutExtension (org.junit.jupiter.engine.extension)
interceptBeforeEachMethod:76, TimeoutExtension (org.junit.jupiter.engine.extension)
apply:-1, 1658512704 (org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$$Lambda$342)
lambda$ofVoidMethod$0:115, ExecutableInvoker$ReflectiveInterceptorCall (org.junit.jupiter.engine.execution)
apply:-1, 33233312 (org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall$$Lambda$166)
lambda$invoke$0:105, ExecutableInvoker (org.junit.jupiter.engine.execution)
apply:-1, 948250363 (org.junit.jupiter.engine.execution.ExecutableInvoker$$Lambda$324)
proceed:106, InvocationInterceptorChain$InterceptedInvocation (org.junit.jupiter.engine.execution)
proceed:64, InvocationInterceptorChain (org.junit.jupiter.engine.execution)
chainAndInvoke:45, InvocationInterceptorChain (org.junit.jupiter.engine.execution)
invoke:37, InvocationInterceptorChain (org.junit.jupiter.engine.execution)
invoke:104, ExecutableInvoker (org.junit.jupiter.engine.execution)
invoke:98, ExecutableInvoker (org.junit.jupiter.engine.execution)
invokeMethodInExtensionContext:506, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
lambda$synthesizeBeforeEachMethodAdapter$21:491, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
invokeBeforeEachMethod:-1, 861623840 (org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$$Lambda$293)
lambda$invokeBeforeEachMethods$3:171, TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor)
invoke:-1, 1275009283 (org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$341)
lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$6:199, TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor)
execute:-1, 453398853 (org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$338)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
invokeBeforeMethodsOrCallbacksUntilExceptionOccurs:199, TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor)
invokeBeforeEachMethods:168, TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor)
execute:131, TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor)
execute:66, TestMethodTestDescriptor (org.junit.jupiter.engine.descriptor)
lambda$executeRecursively$6:151, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, 1932597611 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$260)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, 93054696 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$259)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, 49222910 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$258)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
accept:-1, 1262548561 (org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$264)
forEach:1541, ArrayList (java.util)
invokeAll:41, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$6:155, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, 1932597611 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$260)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, 93054696 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$259)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, 49222910 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$258)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
accept:-1, 1262548561 (org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$264)
forEach:1541, ArrayList (java.util)
invokeAll:41, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$6:155, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, 1932597611 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$260)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, 93054696 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$259)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, 49222910 (org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$258)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
submit:35, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
execute:57, HierarchicalTestExecutor (org.junit.platform.engine.support.hierarchical)
execute:54, HierarchicalTestEngine (org.junit.platform.engine.support.hierarchical)
execute:108, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:88, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
lambda$execute$0:54, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
accept:-1, 1360215046 (org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda$220)
withInterceptedStreams:67, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:52, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:96, DefaultLauncher (org.junit.platform.launcher.core)
execute:75, DefaultLauncher (org.junit.platform.launcher.core)
processAllTestClasses:99, JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor (org.gradle.api.internal.tasks.testing.junitplatform)
access$000:79, JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor (org.gradle.api.internal.tasks.testing.junitplatform)
stop:75, JUnitPlatformTestClassProcessor (org.gradle.api.internal.tasks.testing.junitplatform)
stop:61, SuiteTestClassProcessor (org.gradle.api.internal.tasks.testing)
invoke0:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:62, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:43, DelegatingMethodAccessorImpl (jdk.internal.reflect)
invoke:566, Method (java.lang.reflect)
dispatch:36, ReflectionDispatch (org.gradle.internal.dispatch)
dispatch:24, ReflectionDispatch (org.gradle.internal.dispatch)
dispatch:33, ContextClassLoaderDispatch (org.gradle.internal.dispatch)
invoke:94, ProxyDispatchAdapter$DispatchingInvocationHandler (org.gradle.internal.dispatch)
stop:-1, $Proxy2 (com.sun.proxy)
run:193, TestWorker$3 (org.gradle.api.internal.tasks.testing.worker)
executeAndMaintainThreadName:129, TestWorker (org.gradle.api.internal.tasks.testing.worker)
execute:100, TestWorker (org.gradle.api.internal.tasks.testing.worker)
execute:60, TestWorker (org.gradle.api.internal.tasks.testing.worker)
execute:56, ActionExecutionWorker (org.gradle.process.internal.worker.child)
call:133, SystemApplicationClassLoaderWorker (org.gradle.process.internal.worker.child)
call:71, SystemApplicationClassLoaderWorker (org.gradle.process.internal.worker.child)
run:69, GradleWorkerMain (worker.org.gradle.process.internal.worker)
main:74, GradleWorkerMain (worker.org.gradle.process.internal.worker)
bgalek commented 2 years ago

hi! Next release will drop shadow as it caused more problems than it should!

bgalek commented 2 years ago

https://github.com/allegro/axion-release-plugin/pull/460

bgalek commented 2 years ago

1.13.7 without shadow plugin released