org/gradle/internal/service/DefaultServiceRegistry

文章描述了在使用ThingsBoard的gradle-maven-plugin时遇到的错误,由于找不到org.gradle.internal.service.DefaultServiceRegistry类,导致编译失败。解决方案是检查gradle版本并确保gradle-base-services-7.1.1.jar包含所需类。
摘要由CSDN通过智能技术生成

编译 thingsboard 时报错

Caused by: org.apache.maven.plugin.PluginContainerException: A required class was missing while executing org.thingsboard:gradle-maven-plugin:1.0.11:invoke: org/gradle/internal/service/DefaultServiceRegistry
 

原因分析及解决办法如下

-----------------------------------------------------
realm =    plugin>org.thingsboard:gradle-maven-plugin:1.0.11
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/D:/repo/org/thingsboard/gradle-maven-plugin/1.0.11/gradle-maven-plugin-1.0.11.jar
urls[1] = file:/D:/repo/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
urls[2] = file:/D:/repo/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
urls[3] = file:/D:/repo/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
urls[4] = file:/D:/repo/org/codehaus/plexus/plexus-interpolation/1.25/plexus-interpolation-1.25.jar
urls[5] = file:/D:/repo/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
urls[6] = file:/D:/repo/org/apache/maven/maven-builder-support/3.8.2/maven-builder-support-3.8.2.jar
urls[7] = file:/D:/repo/org/apache/maven/resolver/maven-resolver-util/1.6.3/maven-resolver-util-1.6.3.jar
urls[8] = file:/D:/repo/org/apache/maven/shared/maven-shared-utils/3.3.4/maven-shared-utils-3.3.4.jar
urls[9] = file:/D:/repo/commons-io/commons-io/2.6/commons-io-2.6.jar
urls[10] = file:/D:/repo/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.4/org.eclipse.sisu.inject-0.3.4.jar
urls[11] = file:/D:/repo/com/google/inject/guice/4.2.2/guice-4.2.2-no_aop.jar
urls[12] = file:/D:/repo/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
urls[13] = file:/D:/repo/com/google/guava/guava/25.1-android/guava-25.1-android.jar
urls[14] = file:/D:/repo/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
urls[15] = file:/D:/repo/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar
urls[16] = file:/D:/repo/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar
urls[17] = file:/D:/repo/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar
urls[18] = file:/D:/repo/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
urls[19] = file:/D:/repo/org/codehaus/plexus/plexus-component-annotations/2.1.0/plexus-component-annotations-2.1.0.jar
urls[20] = file:/D:/repo/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar
urls[21] = file:/D:/repo/org/gradle/gradle-tooling-api/7.1.1/gradle-tooling-api-7.1.1.jar
urls[22] = file:/D:/repo/org/codehaus/groovy/groovy-all/3.0.9/groovy-all-3.0.9.pom
urls[23] = file:/D:/repo/org/codehaus/groovy/groovy/3.0.9/groovy-3.0.9.jar
urls[24] = file:/D:/repo/org/codehaus/groovy/groovy-ant/3.0.9/groovy-ant-3.0.9.jar
urls[25] = file:/D:/repo/org/apache/ant/ant/1.10.11/ant-1.10.11.jar
urls[26] = file:/D:/repo/org/apache/ant/ant-junit/1.10.11/ant-junit-1.10.11.jar
urls[27] = file:/D:/repo/org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar
urls[28] = file:/D:/repo/org/apache/ant/ant-antlr/1.10.11/ant-antlr-1.10.11.jar
urls[29] = file:/D:/repo/org/codehaus/groovy/groovy-astbuilder/3.0.9/groovy-astbuilder-3.0.9.jar
urls[30] = file:/D:/repo/org/codehaus/groovy/groovy-cli-picocli/3.0.9/groovy-cli-picocli-3.0.9.jar
urls[31] = file:/D:/repo/info/picocli/picocli/4.6.1/picocli-4.6.1.jar
urls[32] = file:/D:/repo/org/codehaus/groovy/groovy-console/3.0.9/groovy-console-3.0.9.jar
urls[33] = file:/D:/repo/org/codehaus/groovy/groovy-datetime/3.0.9/groovy-datetime-3.0.9.jar
urls[34] = file:/D:/repo/org/codehaus/groovy/groovy-docgenerator/3.0.9/groovy-docgenerator-3.0.9.jar
urls[35] = file:/D:/repo/com/thoughtworks/qdox/qdox/1.12.1/qdox-1.12.1.jar
urls[36] = file:/D:/repo/org/codehaus/groovy/groovy-groovydoc/3.0.9/groovy-groovydoc-3.0.9.jar
urls[37] = file:/D:/repo/com/github/javaparser/javaparser-core/3.23.0/javaparser-core-3.23.0.jar
urls[38] = file:/D:/repo/org/codehaus/groovy/groovy-groovysh/3.0.9/groovy-groovysh-3.0.9.jar
urls[39] = file:/D:/repo/jline/jline/2.14.6/jline-2.14.6.jar
urls[40] = file:/D:/repo/org/codehaus/groovy/groovy-jmx/3.0.9/groovy-jmx-3.0.9.jar
urls[41] = file:/D:/repo/org/codehaus/groovy/groovy-json/3.0.9/groovy-json-3.0.9.jar
urls[42] = file:/D:/repo/org/codehaus/groovy/groovy-jsr223/3.0.9/groovy-jsr223-3.0.9.jar
urls[43] = file:/D:/repo/org/codehaus/groovy/groovy-macro/3.0.9/groovy-macro-3.0.9.jar
urls[44] = file:/D:/repo/org/codehaus/groovy/groovy-nio/3.0.9/groovy-nio-3.0.9.jar
urls[45] = file:/D:/repo/org/codehaus/groovy/groovy-servlet/3.0.9/groovy-servlet-3.0.9.jar
urls[46] = file:/D:/repo/org/codehaus/groovy/groovy-sql/3.0.9/groovy-sql-3.0.9.jar
urls[47] = file:/D:/repo/org/codehaus/groovy/groovy-swing/3.0.9/groovy-swing-3.0.9.jar
urls[48] = file:/D:/repo/org/codehaus/groovy/groovy-templates/3.0.9/groovy-templates-3.0.9.jar
urls[49] = file:/D:/repo/org/codehaus/groovy/groovy-test/3.0.9/groovy-test-3.0.9.jar
urls[50] = file:/D:/repo/junit/junit/4.13.2/junit-4.13.2.jar
urls[51] = file:/D:/repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
urls[52] = file:/D:/repo/org/codehaus/groovy/groovy-test-junit5/3.0.9/groovy-test-junit5-3.0.9.jar
urls[53] = file:/D:/repo/org/junit/jupiter/junit-jupiter-api/5.7.2/junit-jupiter-api-5.7.2.jar
urls[54] = file:/D:/repo/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
urls[55] = file:/D:/repo/org/junit/platform/junit-platform-launcher/1.7.2/junit-platform-launcher-1.7.2.jar
urls[56] = file:/D:/repo/org/junit/platform/junit-platform-engine/1.7.2/junit-platform-engine-1.7.2.jar
urls[57] = file:/D:/repo/org/junit/platform/junit-platform-commons/1.7.2/junit-platform-commons-1.7.2.jar
urls[58] = file:/D:/repo/org/junit/jupiter/junit-jupiter-engine/5.7.2/junit-jupiter-engine-5.7.2.jar
urls[59] = file:/D:/repo/org/codehaus/groovy/groovy-testng/3.0.9/groovy-testng-3.0.9.jar
urls[60] = file:/D:/repo/org/testng/testng/7.4.0/testng-7.4.0.jar
urls[61] = file:/D:/repo/com/beust/jcommander/1.78/jcommander-1.78.jar
urls[62] = file:/D:/repo/org/webjars/jquery/3.5.1/jquery-3.5.1.jar
urls[63] = file:/D:/repo/org/codehaus/groovy/groovy-xml/3.0.9/groovy-xml-3.0.9.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[project>org.thingsboard.transport:http:3.5.2-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]

-----------------------------------------------------

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:169)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NoClassDefFoundError: org/gradle/internal/service/DefaultServiceRegistry
    at org.gradle.tooling.GradleConnector.newConnector (GradleConnector.java:86)
    at org.fortasoft.maven.plugin.gradle.GradleMojo.execute (GradleMojo.java:202)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.ClassNotFoundException: org.gradle.internal.service.DefaultServiceRegistry
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass (ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:239)
    at org.gradle.tooling.GradleConnector.newConnector (GradleConnector.java:86)
原因: java.lang.ClassNotFoundException: version
 

主要原因就是 找不到类 org/gradle/internal/service/DefaultServiceRegistry

通过分析 gradle-7.1.1 lib包里面关于gradle的jar包, 发现此类存放在 gradle-base-services-7.1.1.jar 包中

评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值