oss-review-toolkit / ort

A suite of tools to automate software compliance checks.
https://oss-review-toolkit.org
Apache License 2.0
1.6k stars 309 forks source link

Exception when using GradleInspector with Java 21 and Gradle<8.2 #8027

Closed janek64 closed 7 months ago

janek64 commented 10 months ago

Hello, first of all, thanks for the great work in this project. I recently started testing the GradleInspector plugin for the analyzer instead of the default Gradle plugin and was able to find an issue with specific analysis setups.

When analyzing projects that use an older Gradle version via their wrapper (in my case 7.4.2), the analysis fails with the error message "Unsupported class file major version 65", indicating that there is an incompatibility with the Java version. The analysis results contains no dependencies (as expected). When switching to a more recent Gradle version, the issue does not occur. I tested through the minor versions of Gradle and was able to find out that at least 8.2 was required to successfully perform the analysis. The exact error message differs between the Gradle versions.

Please find the full log of the execution for Gradle 7.4.2:

.\ort -P ort.analyzer.enabledPackageManagers=GradleInspector analyze --input-dir="C:\Users\janek.berg\my-repository" --output-dir .
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en
 ______________________________
/        \_______   \__    ___/  The OSS Review Toolkit, version 9.0.0.
|    |   | |       _/ |    |
|    |   | |    |   \ |    |     Running 'analyze' as 'janek.berg' under Java 21.0.1 on Windows 11
\________/ |____|___/ |____|     with 8 CPUs and a maximum of 4032 MiB of memory.

Environment variables:
ORT_CONFIG_DIR = C:\Users\janek.berg\.ort\config
ORT_DATA_DIR = C:\Users\janek.berg\.ort
USERPROFILE = C:\Users\janek.berg
OS = Windows_NT
COMSPEC = C:\WINDOWS\system32\cmd.exe
JAVA_HOME = C:\Users\janek.berg\scoop\apps\temurin21-jdk\current

Looking for ORT configuration in the following file:
        C:\Users\janek.berg\.ort\config\config.yml (does not exist)

Looking for analyzer-specific configuration in the following files and directories:
        C:\Users\janek.berg\my-repository\.ort.yml (does not exist)
        C:\Users\janek.berg\.ort\config\resolutions.yml (does not exist)
The following 1 package manager(s) are enabled:
        GradleInspector
The following 2 package curation provider(s) are enabled:
        DefaultDir, DefaultFile
Analyzing project path:
        C:\Users\janek.berg\my-repository
Found 1 GradleInspector definition file(s) at:
        build.gradle
Found in total 1 definition file(s) from the following 1 package manager(s):
        GradleInspector
16:25:33.413 [DefaultDispatcher-worker-1] ERROR java.lang.Object - GradleInspector failed to resolve dependencies for path 'build.gradle': BuildException: Could not fetch model of type 'OrtDependencyTreeModel' using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.4.2-bin.zip'.
Caused by: LocationAwareException: Initialization script 'C:\Users\janek.berg\.ort\tools\GradleInspector\init.gradle'
Could not compile initialization script 'C:\Users\janek.berg\.ort\tools\GradleInspector\init.gradle'.
    Caused by: ContextualPlaceholderException: Could not compile initialization script 'C:\Users\janek.berg\.ort\tools\GradleInspector\init.gradle'.
        Caused by: PlaceholderException: startup failed:
        General error during conversion: Unsupported class file major version 65

        java.lang.IllegalArgumentException: Unsupported class file major version 65
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:199)
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:180)
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:166)
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:287)
                at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
                at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
                at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)
                at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:169)
                at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:125)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:57)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:44)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:79)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:70)
                at org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:58)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lambda$createMethodNode$1(DecompiledClassNode.java:230)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.createMethodNode(DecompiledClassNode.java:236)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:203)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getDeclaredMethods(DecompiledClassNode.java:122)
                at org.codehaus.groovy.ast.ClassNode.tryFindPossibleMethod(ClassNode.java:1283)
                at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:251)
                at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:133)
                at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:108)
                at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
                at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:66)
                at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:108)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:101)
                at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1089)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
                at org.codehaus.groovy.control.CompilationUnit.lambda$addPhaseOperations$3(CompilationUnit.java:209)
                at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
                at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:671)
                at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:635)
                at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
                at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
                at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
                at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
                at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
                at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:139)
                at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:95)
                at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler$2.run(BuildOperationBackedScriptCompilationHandler.java:54)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler.compileToDir(BuildOperationBackedScriptCompilationHandler.java:51)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:190)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:170)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:211)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:194)
                at org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(DefaultPersistentDirectoryCache.java:100)
                at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess$1.run(FixedSharedModeCrossProcessCacheAccess.java:86)
                at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:216)
                at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:206)
                at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess.open(FixedSharedModeCrossProcessCacheAccess.java:83)
                at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:139)
                at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:89)
                at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:43)
                at org.gradle.cache.internal.DefaultCacheFactory.doOpen(DefaultCacheFactory.java:103)
                at org.gradle.cache.internal.DefaultCacheFactory.open(DefaultCacheFactory.java:68)
                at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.open(DefaultCacheRepository.java:117)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:116)
                at org.gradle.groovy.scripts.internal.CrossBuildInMemoryCachingScriptClassCache.getOrCompile(CrossBuildInMemoryCachingScriptClassCache.java:50)
                at org.gradle.groovy.scripts.internal.BuildScopeInMemoryCachingScriptClassCompiler.compile(BuildScopeInMemoryCachingScriptClassCompiler.java:50)
                at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:49)
                at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:110)
                at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
                at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
                at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
                at org.gradle.configuration.DefaultInitScriptProcessor.process(DefaultInitScriptProcessor.java:50)
                at org.gradle.initialization.InitScriptHandler$1.run(InitScriptHandler.java:56)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.initialization.InitScriptHandler.executeScripts(InitScriptHandler.java:51)
                at org.gradle.initialization.InitScriptHandlingSettingsLoader.findAndLoadSettings(InitScriptHandlingSettingsLoader.java:33)
                at org.gradle.initialization.GradlePropertiesHandlingSettingsLoader.findAndLoadSettings(GradlePropertiesHandlingSettingsLoader.java:39)
                at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:31)
                at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperationFiringSettingsPreparer.java:62)
                at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.run(BuildOperationFiringSettingsPreparer.java:57)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.initialization.BuildOperationFiringSettingsPreparer.prepareSettings(BuildOperationFiringSettingsPreparer.java:45)
                at org.gradle.initialization.VintageBuildModelController.lambda$prepareSettings$2(VintageBuildModelController.java:85)
                at org.gradle.internal.model.StateTransitionController.lambda$doTransition$12(StateTransitionController.java:227)
                at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:238)
                at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:226)
                at org.gradle.internal.model.StateTransitionController.lambda$transitionIfNotPreviously$10(StateTransitionController.java:201)
                at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
                at org.gradle.internal.model.StateTransitionController.transitionIfNotPreviously(StateTransitionController.java:197)
                at org.gradle.initialization.VintageBuildModelController.prepareSettings(VintageBuildModelController.java:85)
                at org.gradle.initialization.VintageBuildModelController.getConfiguredModel(VintageBuildModelController.java:63)
                at org.gradle.internal.build.DefaultBuildLifecycleController.lambda$withProjectsConfigured$1(DefaultBuildLifecycleController.java:121)
                at org.gradle.internal.model.StateTransitionController.lambda$notInState$4(StateTransitionController.java:143)
                at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
                at org.gradle.internal.model.StateTransitionController.notInState(StateTransitionController.java:139)
                at org.gradle.internal.build.DefaultBuildLifecycleController.withProjectsConfigured(DefaultBuildLifecycleController.java:121)
                at org.gradle.internal.build.DefaultBuildToolingModelController.locateBuilderForTarget(DefaultBuildToolingModelController.java:57)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.lambda$locateBuilderForTarget$0(DefaultBuildTreeModelCreator.java:73)
                at org.gradle.internal.build.DefaultBuildLifecycleController.withToolingModels(DefaultBuildLifecycleController.java:178)
                at org.gradle.internal.build.AbstractBuildState.withToolingModels(AbstractBuildState.java:111)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.locateBuilderForTarget(DefaultBuildTreeModelCreator.java:73)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.locateBuilderForDefaultTarget(DefaultBuildTreeModelCreator.java:68)
                at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner$ModelCreateAction.fromBuildModel(BuildModelActionRunner.java:81)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator.fromBuildModel(DefaultBuildTreeModelCreator.java:57)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$fromBuildModel$1(DefaultBuildTreeLifecycleController.java:82)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:106)
                at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:166)
                at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:238)
                at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:166)
                at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
                at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:166)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:103)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.fromBuildModel(DefaultBuildTreeLifecycleController.java:74)
                at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:49)
                at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
                at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49)
                at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:69)
                at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:119)
                at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
                at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40)
                at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:128)
                at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40)
                at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40)
                at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:65)
                at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53)
                at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:65)
                at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61)
                at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
                at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57)
                at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:36)
                at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270)
                at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119)
                at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:36)
                at org.gradle.tooling.internal.provider.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:103)
                at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64)
                at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:100)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:88)
                at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:69)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:62)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:41)
                at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:63)
                at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
                at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:58)
                at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)
                at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
                at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
                at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
                at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
                at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
                at org.gradle.util.internal.Swapper.swap(Swapper.java:38)
                at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
                at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
                at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
                at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
                at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
                at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
                at java.base/java.lang.Thread.run(Thread.java:1583)

        1 error
Writing analyzer result to 'C:\Users\janek.berg\Downloads\ort-9.0.0\ort-9.0.0\bin\analyzer-result.yml'.
The analysis took 4.859813400s.
Found 1 project(s) and 0 package(s) in total (not counting excluded ones).
Applied 0 curation(s) from 0 of 2 provider(s).
Resolved issues: 0 errors, 0 warnings, 0 hints.
Unresolved issues: 1 error, 0 warnings, 0 hints.
There is 1 unresolved issue with a severity equal to or greater than the WARNING threshold.
sschuberth commented 10 months ago

Thanks @janek64 for taking the time to file the issue. The GradleInspector works much different than the "legacy" Gradle analyzer in that it ships with a pre-compiled Gradle plugin that we inject into the build process. And this pre-compilation happens with the same JVM target that is used for ORT itself.

So, if you're using an older version of Gradle, you might also be stuck on an older version of Java in your project, and that version cannot interpret the bytecode of the plugin we ship.

TL;DR you might be able to address the issue by lowering the JVM target version of the gradle-plugin project and its project dependencies. I've scribbled down https://github.com/oss-review-toolkit/ort/pull/8028 which you might want to give a try.

janek64 commented 10 months ago

Hi @sschuberth, thanks for the fast reply and help. I now found the time for it and checked out the branch with your changes, but it seems like it is not resolving the issue. See the following log of a run I executed with the Gradle cli:run task. Gradle version behaviour is still the same, works for >=8.2.

Please let me know if there is anything else I can do to help with finding a solution.

git checkout gi-lower-jvm-target
Switched to a new branch 'gi-lower-jvm-target'
branch 'gi-lower-jvm-target' set up to track 'origin/gi-lower-jvm-target'.

./gradlew cli:run --args="-P ort.analyzer.enabledPackageManagers=GradleInspector analyze --input-dir="C:\Users\janek.berg\my-repo" --output-dir C:\Users\janek.berg\my-repo"
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en
Starting a Gradle Daemon, 2 busy Daemons could not be reused, use --status for details

> Configure project :
Building ORT version 10.0.0-022.sha.c4f2d8a.

> Task :utils:spdx-utils:generateGrammarSource
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en

> Task :kotlinNodeJsSetup
Setting up Node.js / NPM in 'C:\Users\janek.berg\.gradle\nodejs\node-v16.13.0-win-x64'...

> Task :kotlinYarnSetup
Setting up Yarn in 'C:\Users\janek.berg\.gradle\yarn\yarn-v1.22.17'...

> Task :plugins:reporters:web-app-template:yarnInstall
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > @testing-library/user-event@14.4.3" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning " > html-inline-css-webpack-plugin@1.11.1" has unmet peer dependency "html-webpack-plugin@^3.0.0 || ^4.0.0 || ^5.0.0".
[4/4] Building fresh packages...
Done in 271.75s.

> Task :plugins:reporters:web-app-template:yarnBuild
yarn run v1.22.17
$ rescripts build
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Removing unneeded files in build dir...
Creating ORT template file...
Compiled successfully.

File sizes after gzip:

  411.49 KB  build\static\js\2.ece6e051.chunk.js
  23.88 KB   build\static\js\main.949e4ea2.chunk.js
  779 B      build\static\js\runtime-main.17ac84bf.js

The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  https://cra.link/deployment

Done in 97.76s.

> Task :cli:run
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en
 ______________________________
/        \_______   \__    ___/  The OSS Review Toolkit, version 10.0.0-022.sha
|    |   | |       _/ |    |
|    |   | |    |   \ |    |     Running 'analyze' as 'janek.berg' under Java 2
\________/ |____|___/ |____|     with 8 CPUs and a maximum of 4032 MiB of memor

Environment variables:
ORT_CONFIG_DIR = C:\Users\janek.berg\.ort\config
ORT_DATA_DIR = C:\Users\janek.berg\.ort
USERPROFILE = C:\Users\janek.berg
OS = Windows_NT
COMSPEC = C:\WINDOWS\system32\cmd.exe
JAVA_HOME = C:\Users\janek.berg\scoop\apps\temurin21-jdk\current

Looking for ORT configuration in the following file:
        C:\Users\janek.berg\.ort\config\config.yml (does not exist)

Looking for analyzer-specific configuration in the following files and directories:
        C:\Users\janek.berg\my-repo\.ort.yml (does not exist)
        C:\Users\janek.berg\.ort\config\resolutions.yml (does not exist)
The following 1 package manager(s) are enabled:
        GradleInspector
The following 2 package curation provider(s) are enabled:
        DefaultDir, DefaultFile
Analyzing project path:
        C:\Users\janek.berg\my-repo
Found 1 GradleInspector definition file(s) at:
        build.gradle
Found in total 1 definition file(s) from the following 1 package manager(s):
        GradleInspector
16:51:46.501 [DefaultDispatcher-worker-1] ERROR java.lang.Object - GradleInspector failed to resolve dependencies for path 'build.gradle': BuildException: Could not fetch model of type 'OrtDependencyTreeModel' using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.4.2-bin.zip'.
Caused by: LocationAwareException: Initialization script 'C:\Users\janek.berg\.ort\tools\GradleInspector\init.gradle'
Could not compile initialization script 'C:\Users\janek.berg\.ort\tools\GradleInspector\init.gradle'.
    Caused by: ContextualPlaceholderException: Could not compile initialization script 'C:\Users\janek.berg\.ort\tools\GradleInspector\init.gradle'.
        Caused by: PlaceholderException: startup failed:
        General error during conversion: Unsupported class file major version 65

        java.lang.IllegalArgumentException: Unsupported class file major version 65
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:199)
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:180)
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:166)
                at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:287)
                at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
                at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
                at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)
                at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:169)
                at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:125)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:57)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:44)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:79)
                at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:70)
                at org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:58)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lambda$createMethodNode$1(DecompiledClassNode.java:230)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.createMethodNode(DecompiledClassNode.java:236)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:203)
                at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getDeclaredMethods(DecompiledClassNode.java:122)
                at org.codehaus.groovy.ast.ClassNode.tryFindPossibleMethod(ClassNode.java:1283)
                at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:251)
                at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:133)
                at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:108)
                at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
                at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:66)
                at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:108)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:101)
                at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1089)
                at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
                at org.codehaus.groovy.control.CompilationUnit.lambda$addPhaseOperations$3(CompilationUnit.java:209)
                at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
                at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:671)
                at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:635)
                at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
                at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
                at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
                at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
                at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
                at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:139)
                at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:95)
                at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler$2.run(BuildOperationBackedScriptCompilationHandler.java:54)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler.compileToDir(BuildOperationBackedScriptCompilationHandler.java:51)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:190)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:170)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:211)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:194)
                at org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(DefaultPersistentDirectoryCache.java:100)
                at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess$1.run(FixedSharedModeCrossProcessCacheAccess.java:86)
                at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:216)
                at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:206)
                at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess.open(FixedSharedModeCrossProcessCacheAccess.java:83)
                at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:139)
                at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:89)
                at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:43)
                at org.gradle.cache.internal.DefaultCacheFactory.doOpen(DefaultCacheFactory.java:103)
                at org.gradle.cache.internal.DefaultCacheFactory.open(DefaultCacheFactory.java:68)
                at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.open(DefaultCacheRepository.java:117)
                at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:116)
                at org.gradle.groovy.scripts.internal.CrossBuildInMemoryCachingScriptClassCache.getOrCompile(CrossBuildInMemoryCachingScriptClassCache.java:50)
                at org.gradle.groovy.scripts.internal.BuildScopeInMemoryCachingScriptClassCompiler.compile(BuildScopeInMemoryCachingScriptClassCompiler.java:50)
                at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:49)
                at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:110)
                at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
                at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
                at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
                at org.gradle.configuration.DefaultInitScriptProcessor.process(DefaultInitScriptProcessor.java:50)
                at org.gradle.initialization.InitScriptHandler$1.run(InitScriptHandler.java:56)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.initialization.InitScriptHandler.executeScripts(InitScriptHandler.java:51)
                at org.gradle.initialization.InitScriptHandlingSettingsLoader.findAndLoadSettings(InitScriptHandlingSettingsLoader.java:33)
                at org.gradle.initialization.GradlePropertiesHandlingSettingsLoader.findAndLoadSettings(GradlePropertiesHandlingSettingsLoader.java:39)
                at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:31)
                at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperationFiringSettingsPreparer.java:62)
                at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.run(BuildOperationFiringSettingsPreparer.java:57)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                at org.gradle.initialization.BuildOperationFiringSettingsPreparer.prepareSettings(BuildOperationFiringSettingsPreparer.java:45)
                at org.gradle.initialization.VintageBuildModelController.lambda$prepareSettings$2(VintageBuildModelController.java:85)
                at org.gradle.internal.model.StateTransitionController.lambda$doTransition$12(StateTransitionController.java:227)
                at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:238)
                at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:226)
                at org.gradle.internal.model.StateTransitionController.lambda$transitionIfNotPreviously$10(StateTransitionController.java:201)
                at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
                at org.gradle.internal.model.StateTransitionController.transitionIfNotPreviously(StateTransitionController.java:197)
                at org.gradle.initialization.VintageBuildModelController.prepareSettings(VintageBuildModelController.java:85)
                at org.gradle.initialization.VintageBuildModelController.getConfiguredModel(VintageBuildModelController.java:63)
                at org.gradle.internal.build.DefaultBuildLifecycleController.lambda$withProjectsConfigured$1(DefaultBuildLifecycleController.java:121)
                at org.gradle.internal.model.StateTransitionController.lambda$notInState$4(StateTransitionController.java:143)
                at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
                at org.gradle.internal.model.StateTransitionController.notInState(StateTransitionController.java:139)
                at org.gradle.internal.build.DefaultBuildLifecycleController.withProjectsConfigured(DefaultBuildLifecycleController.java:121)
                at org.gradle.internal.build.DefaultBuildToolingModelController.locateBuilderForTarget(DefaultBuildToolingModelController.java:57)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.lambda$locateBuilderForTarget$0(DefaultBuildTreeModelCreator.java:73)
                at org.gradle.internal.build.DefaultBuildLifecycleController.withToolingModels(DefaultBuildLifecycleController.java:178)
                at org.gradle.internal.build.AbstractBuildState.withToolingModels(AbstractBuildState.java:111)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.locateBuilderForTarget(DefaultBuildTreeModelCreator.java:73)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator$DefaultBuildTreeModelController.locateBuilderForDefaultTarget(DefaultBuildTreeModelCreator.java:68)
                at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner$ModelCreateAction.fromBuildModel(BuildModelActionRunner.java:81)
                at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator.fromBuildModel(DefaultBuildTreeModelCreator.java:57)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$fromBuildModel$1(DefaultBuildTreeLifecycleController.java:82)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:106)
                at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:166)
                at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:238)
                at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:166)
                at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
                at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:166)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:103)
                at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.fromBuildModel(DefaultBuildTreeLifecycleController.java:74)
                at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:49)
                at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
                at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49)
                at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:69)
                at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:119)
                at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
                at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40)
                at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:128)
                at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40)
                at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40)
                at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:65)
                at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53)
                at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:65)
                at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61)
                at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
                at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
                at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57)
                at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:36)
                at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270)
                at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119)
                at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:36)
                at org.gradle.tooling.internal.provider.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:103)
                at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64)
                at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:100)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:88)
                at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:69)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:62)
                at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:41)
                at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:63)
                at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
                at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:58)
                at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)
                at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
                at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
                at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
                at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
                at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
                at org.gradle.util.internal.Swapper.swap(Swapper.java:38)
                at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
                at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
                at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
                at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
                at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
                at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
                at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
                at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
                at java.base/java.lang.Thread.run(Thread.java:1583)

        1 error
Writing analyzer result to 'C:\Users\janek.berg\my-repo\analyzer-result.yml'.
The analysis took 5.677802100s.
Found 1 project(s) and 0 package(s) in total (not counting excluded ones).
Applied 0 curation(s) from 0 of 2 provider(s).
Resolved issues: 0 errors, 0 warnings, 0 hints.
Unresolved issues: 1 error, 0 warnings, 0 hints.
There is 1 unresolved issue with a severity equal to or greater than the WARNING threshold.

> Task :cli:run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cli:run'.
> Process 'command 'C:\Users\janek.berg\scoop\apps\temurin21-jdk\current\bin\java.exe'' finished with non-zero exit value 2

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 9m 23s
368 actionable tasks: 359 executed, 9 up-to-date
janniclas commented 10 months ago

I encountered the same (?) error in a different use case. I've included ORT as a library in my Kotlin project and use it programmatically. My project uses Gradle 8.5, Kotlin 1.9.21 and java source/target compatibility and jvmTarget 21. Locally I'm able to analyze a project which uses Gradle 7.6.1. However, if I execute my program inside a Docker container (using e.g. gradle:8.5-jdk21-jammy as a base image) I also encounter the Unsupported Class File major version error. @sschuberth I'm not sure if this is really related or if this should be a separate issue, I just stumbled across this issue here when investigating my problem.


08:14:37.774 [DefaultDispatcher-worker-5] INFO org.ossreviewtoolkit.analyzer.PackageManager -- Using Gradle to resolve dependencies for path 'build.gradle.kts'...
08:14:38.054 [DefaultDispatcher-worker-5] ERROR java.lang.Object -- Gradle failed to resolve dependencies for path 'build.gradle.kts': BuildException: Could not fetch model of type 'OrtDependencyTreeModel' using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.6.1-bin.zip'.
Caused by: LocationAwareException: Could not open init generic class cache for initialization script '/tmp/ort-Gradle10103480875358543466/init2775937530921482843.gradle' (/root/.gradle/caches/7.6.1/scripts/czqqmbaxuofufn6nnljx3fs3u).
    Caused by: CacheOpenException: Could not open init generic class cache for initialization script '/tmp/ort-Gradle10103480875358543466/init2775937530921482843.gradle' (/root/.gradle/caches/7.6.1/scripts/czqqmbaxuofufn6nnljx3fs3u).
        Caused by: GroovyBugError: BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
            Caused by: IllegalArgumentException: Unsupported class file major version 65
08:14:38.054 [DefaultDispatcher-worker-5] INFO org.ossreviewtoolkit.analyzer.PackageManager -- Gradle resolved dependencies for path 'build.gradle.kts' in 280.761459ms. ```
sschuberth commented 10 months ago

@janniclas I believe your issue has a different root cause due to the GroovyBugError: BUG! part. That indicates to me that the Gradle project you're analyzing uses Groovy DSL instead of Kotlin DSL for its build files, can you confirm on that? If so, the issue could be unrelated to ORT, but come from one of the dependencies in the project, see similar reports like https://github.com/quarkusio/quarkus/issues/33911.

janniclas commented 10 months ago

No, I can't confirm that. The project I'm analyzing uses Kotlin DSL for its build file. What threw me off is that I'm able to analyze the same project on my local machine, but not inside a docker container. That's why I assumed that the issue is not a build file problem of the project to be analyzed but rather some implicit version problem of gradle/java from my project to the analyzed project. However, as far as my understanding goes this should not happen as both my project using the ORT as a library, as well as the project I'm analyzing use a gradle wrapper.

Or is there a dependency between the gradle version the project which uses the ORT is compiled with and the project I want to analyze (this would still not explain why I'm able to run this locally)?

sschuberth commented 10 months ago

Or is there a dependency between the gradle version the project

No. But can it be that you're using different JVM version to run ORT on your local machine vs the one in the Docker image?

janniclas commented 10 months ago
docker:
./gradlew installDist --info
Initialized native services in: /root/.gradle/native
Initialized jansi services in: /root/.gradle/native
Received JVM installation metadata from '/usr/lib/jvm/java-21-openjdk-arm64': {JAVA_HOME=/usr/lib/jvm/java-21-openjdk-arm64, JAVA_VERSION=21.0.1, JAVA_VENDOR=Private Build, RUNTIME_NAME=OpenJDK Runtime Environment, RUNTIME_VERSION=21.0.1+12-Ubuntu-222.04, VM_NAME=OpenJDK 64-Bit Server VM, VM_VERSION=21.0.1+12-Ubuntu-222.04, VM_VENDOR=Private Build, OS_ARCH=aarch64}

locally:
./gradlew installDist --info
Initialized native services in: /Users/s/.gradle/native
Initialized jansi services in: /Users/s/.gradle/native
Received JVM installation metadata from '/opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home': {JAVA_HOME=/opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home, JAVA_VERSION=21.0.1, JAVA_VENDOR=Homebrew, RUNTIME_NAME=OpenJDK Runtime Environment, RUNTIME_VERSION=21.0.1, VM_NAME=OpenJDK 64-Bit Server VM, VM_VERSION=21.0.1, VM_VENDOR=Homebrew, OS_ARCH=aarch64}

I get the same info when running ./gradlew run ... to execute the application on both systems. So to me it looks like both use Java 21.0.1 for building and running. Do you have any further ideas on how to debug this issue to determine if this is a ORT problem in the first place? I'm more than happy to look more deeply into this but I'm currently at a loss on where to start with it.

sschuberth commented 10 months ago

Hmm, in JAVA_HOME=/usr/lib/jvm/java-21-openjdk-arm64 the arm64 stands out. But I see you're also on aarch64 on your host machine, so you're on a Mac, not a PC with Linux. Which makes it hard for me to reproduce / help as I don't have access to a Mac, even if actually it should not be related to running on a Mac at all.

Can you try upgrading the project to Gradle 8.5 in any case?

janniclas commented 10 months ago

I created a minimal example to reproduce the described behavior and also ran it with docker on a linux machine with the same outcome. This repository contains a minimal Kotlin application using the ORT analyzer. When running it on a repository with gradle version 8.5 it works as expected. When running it on a repository with gradle version 7.2 I get the error described above. Inside the repository you find a docker image building the Kotlin application which uses the ORT and cloning both the old and new gradle repository inside the docker image. With docker run orttest --args="/app/OldGradleVersion" or docker run orttest --args="/app/OldGradleVersion" you can execute the Kotlin program on the matching gradle project to reproduce the error.

To also address your question if I'm able to upgrade the project to a newer Gradle version, yes that would be possible, however I'm currently interested in analyzing a projects dependency behavior over time, so I regularly encounter older gradle versions, that's why I'm interested in understanding whether it is theoretical possible to run the ORT on these older versions.

EDIT: I also updated the ORT version to the newly released 11.0.0 and rerun the tests with the same results

sschuberth commented 7 months ago

When running it on a repository with gradle version 7.2 I get the error described above.

I wanted to try whether this helped, and indeed with latest main that repository seems to get analyzed correctly with ORT using GradleInspector:

image

Please verify @janek64 / @janniclas and feel free to reopen if the issue persists for you.

janek64 commented 6 months ago

Hi @sschuberth, sorry for the late response, I missed the update on this issue. Thank you for taking care of this.

I retested my scenario (Gradle 7.4.2) with ORT 22.0.0-025.sha.c4c14f2 today and faced the same error I initially described.

Based on the issues that you mentioned, I understand that it is necessary to have multiple Java versions available on the host system in order to make use of the new improvements. Is this correct?

I am embedding the ORT analyzer library into my application which is deployed as a container with Java 21 as the base image. Do I need to also install older JDKs into my image in order to support older Gradle versions?

sschuberth commented 6 months ago

I understand that it is necessary to have multiple Java versions available on the host system in order to make use of the new improvements. Is this correct?

No, that's not the case. I have some additional ideas how to satisfy any special Java version requirements via bootstrapping, but that's not implemented yet. My current changes were meaning to "align on the smallest common denominator" to make things work, but apparently more work is need for your use case.

Do I need to also install older JDKs into my image in order to support older Gradle versions?

No, see above.

But to rule out any caching issues, could you make sure to delete the ~/.ort/tools/GradleInspector directory before your analyzer run? I have a hunch that still a gradle-plugin.jar version that was compiled for a newer Java version is used.

sschuberth commented 6 months ago

I have a hunch that still a gradle-plugin.jar version that was compiled for a newer Java version is used.

So the META-INF/MANIFEST.MF file inside that JAR should contain a line saying "Build-Jdk: 11.0.20.1+1", i.e. it was not compiled for class file major version 65 / Java 21.

janek64 commented 6 months ago

I deleted to cache directory and executed the tool again, same result regarding the error. I extracted the MANIFEST.MF from the gradle-plugin.jar and these are the contents:

Manifest-Version: 1.0
Implementation-Version: 22.0.0-025.sha.c4c14f2
Build-Jdk: 11.0.22+7
sschuberth commented 6 months ago

I am embedding the ORT analyzer library into my application which is deployed as a container with Java 21

Re-reading this, it indeed seems to be a similar use-case as the one from @janniclas who wrote

I've included ORT as a library in my Kotlin project and use it programmatically.

In both cases, you need to ensure that Java version that runs ORT (or the application that embeds ORT) is compatible with the Gradle project you're analyzing. Full Java 21 support was only added with Gradle 8.5. So if the project under analysis uses a lower Gradle version than that, you need to downgrade the Java version to the version supported by that Gradle version.

We are aware that this coupling of Java versions is unfortunate, and the matter is tracked by this issue.