运行 `mvn endpoints-framework:openApiDocs` 时出现 ClassNotFoundException
ClassNotFoundException when running `mvn endpoints-framework:openApiDocs`
我正处于 GCP openapi guide 的后续步骤,我必须 运行 maven 命令来生成 openapi.json
文件。
我正在关注我自己的项目,所以这可能会或不会通过分叉 example repository 来重现。 (所以我不会,因为我 link 下面是我自己的)
所以当我 运行 他们告诉我的命令时,我得到以下堆栈跟踪,抱怨他们找不到我的 api class,当它非常清楚存在。
C:\Users\********\Projects\********>mvn endpoints-framework:openApiDocs -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< xyz.********:rest >-------------------------
[INFO] Building rest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- endpoints-framework-maven-plugin:2.0.1:openApiDocs (default-cli) @ rest ---
[INFO] Endpoints Tool params : [get-openapi-doc, -o, C:\Users\********\Projects\********\target\openapi-docs\openapi.json, -cp, C:\Users\********\Projects\********\target\classes;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot.3.0.RELEASE\spring-boot-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-core.2.6.RELEASE\spring-core-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-jcl.2.6.RELEASE\spring-jcl-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-context.2.6.RELEASE\spring-context-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-aop.2.6.RELEASE\spring-aop-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-beans.2.6.RELEASE\spring-beans-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-expression.2.6.RELEASE\spring-expression-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot-autoconfigure.3.0.RELEASE\spring-boot-autoconfigure-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot-starter.3.0.RELEASE\spring-boot-starter-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot-starter-logging.3.0.RELEASE\spring-boot-starter-logging-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\ch\qos\logback\logback-classic.2.3\logback-classic-1.2.3.jar;C:\Users\********\.m2\repository\ch\qos\logback\logback-core.2.3\logback-core-1.2.3.jar;C:\Users\********\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j.13.2\log4j-to-slf4j-2.13.2.jar;C:\Users\********\.m2\repository\org\apache\logging\log4j\log4j-api.13.2\log4j-api-2.13.2.jar;C:\Users\********\.m2\repository\org\slf4j\jul-to-slf4j.7.30\jul-to-slf4j-1.7.30.jar;C:\Users\********\.m2\repository\jakarta\annotation\jakarta.annotation-api.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\********\.m2\repository\org\yaml\snakeyaml.26\snakeyaml-1.26.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-starter-data-firestore.2.3.RELEASE\spring-cloud-gcp-starter-data-firestore-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-starter.2.3.RELEASE\spring-cloud-gcp-starter-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-core.2.3.RELEASE\spring-cloud-gcp-core-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\com\google\cloud\google-cloud-core.93.4\google-cloud-core-1.93.4.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-iam-v1[=12=].13.0\proto-google-iam-v1-0.13.0.jar;C:\Users\********\.m2\repository\com\google\auth\google-auth-library-oauth2-http[=12=].20.0\google-auth-library-oauth2-http-0.20.0.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-autoconfigure.2.3.RELEASE\spring-cloud-gcp-autoconfigure-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-data-firestore.2.3.RELEASE\spring-cloud-gcp-data-firestore-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\io\projectreactor\reactor-core.3.5.RELEASE\reactor-core-3.3.5.RELEASE.jar;C:\Users\********\.m2\repository\org\reactivestreams\reactive-streams.0.3\reactive-streams-1.0.3.jar;C:\Users\********\.m2\repository\com\google\cloud\google-cloud-firestore.33.0\google-cloud-firestore-1.33.0.jar;C:\Users\********\.m2\repository\com\google\cloud\google-cloud-core-grpc.93.4\google-cloud-core-grpc-1.93.4.jar;C:\Users\********\.m2\repository\io\grpc\grpc-core.28.1\grpc-core-1.28.1.jar;C:\Users\********\.m2\repository\com\google\android\annotations.1.1.4\annotations-4.1.1.4.jar;C:\Users\********\.m2\repository\io\perfmark\perfmark-api[=12=].19.0\perfmark-api-0.19.0.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-cloud-firestore-admin-v1.33.0\proto-google-cloud-firestore-admin-v1-1.33.0.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-cloud-firestore-v1.33.0\proto-google-cloud-firestore-v1-1.33.0.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-cloud-firestore-v1beta1[=12=].86.0\proto-google-cloud-firestore-v1beta1-0.86.0.jar;C:\Users\********\.m2\repository\com\google\auto\value\auto-value-annotations.7\auto-value-annotations-1.7.jar;C:\Users\********\.m2\repository\io\opencensus\opencensus-contrib-grpc-util[=12=].24.0\opencensus-contrib-grpc-util-0.24.0.jar;C:\Users\********\.m2\repository\com\google\api\api-common.9.0\api-common-1.9.0.jar;C:\Users\********\.m2\repository\io\grpc\grpc-protobuf.28.1\grpc-protobuf-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-protobuf-lite.28.1\grpc-protobuf-lite-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-context.28.1\grpc-context-1.28.1.jar;C:\Users\********\.m2\repository\com\google\protobuf\protobuf-java.11.4\protobuf-java-3.11.4.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-common-protos.17.0\proto-google-common-protos-1.17.0.jar;C:\Users\********\.m2\repository\com\google\api\gax.56.0\gax-1.56.0.jar;C:\Users\********\.m2\repository\io\grpc\grpc-api.28.1\grpc-api-1.28.1.jar;C:\Users\********\.m2\repository\com\google\errorprone\error_prone_annotations.3.4\error_prone_annotations-2.3.4.jar;C:\Users\********\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations.18\animal-sniffer-annotations-1.18.jar;C:\Users\********\.m2\repository\com\google\api\gax-grpc.56.0\gax-grpc-1.56.0.jar;C:\Users\********\.m2\repository\io\grpc\grpc-auth.28.1\grpc-auth-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-netty-shaded.28.1\grpc-netty-shaded-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-alts.28.1\grpc-alts-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-grpclb.28.1\grpc-grpclb-1.28.1.jar;C:\Users\********\.m2\repository\org\conscrypt\conscrypt-openjdk-uber.2.1\conscrypt-openjdk-uber-2.2.1.jar;C:\Users\********\.m2\repository\org\threeten\threetenbp.4.3\threetenbp-1.4.3.jar;C:\Users\********\.m2\repository\io\grpc\grpc-stub.28.1\grpc-stub-1.28.1.jar;C:\Users\********\.m2\repository\io\opencensus\opencensus-api[=12=].24.0\opencensus-api-0.24.0.jar;C:\Users\********\.m2\repository\com\google\auth\google-auth-library-credentials[=12=].20.0\google-auth-library-credentials-0.20.0.jar;C:\Users\********\.m2\repository\com\google\code\gson\gson.8.6\gson-2.8.6.jar;C:\Users\********\.m2\repository\com\google\protobuf\protobuf-java-util.11.4\protobuf-java-util-3.11.4.jar;C:\Users\********\.m2\repository\javax\annotation\javax.annotation-api.3.2\javax.annotation-api-1.3.2.jar;C:\Users\********\.m2\repository\com\google\api\grpc\grpc-google-cloud-firestore-v1.33.0\grpc-google-cloud-firestore-v1-1.33.0.jar;C:\Users\********\.m2\repository\org\springframework\data\spring-data-commons.3.0.RELEASE\spring-data-commons-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-tx.2.6.RELEASE\spring-tx-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\slf4j\slf4j-api.7.30\slf4j-api-1.7.30.jar;C:\Users\********\.m2\repository\com\google\endpoints\endpoints-framework.2.1\endpoints-framework-2.2.1.jar;C:\Users\********\.m2\repository\com\google\guava\guava.0\guava-20.0.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\core\jackson-annotations.11.0\jackson-annotations-2.11.0.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\core\jackson-core.11.0\jackson-core-2.11.0.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\core\jackson-databind.11.0\jackson-databind-2.11.0.jar;C:\Users\********\.m2\repository\com\google\flogger\flogger[=12=].3.1\flogger-0.3.1.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client-jackson2.25.0\google-http-client-jackson2-1.25.0.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client.25.0\google-http-client-1.25.0.jar;C:\Users\********\.m2\repository\org\apache\httpcomponents\httpclient.5.12\httpclient-4.5.12.jar;C:\Users\********\.m2\repository\org\apache\httpcomponents\httpcore.4.13\httpcore-4.4.13.jar;C:\Users\********\.m2\repository\commons-codec\commons-codec.14\commons-codec-1.14.jar;C:\Users\********\.m2\repository\com\google\j2objc\j2objc-annotations.1\j2objc-annotations-1.1.jar;C:\Users\********\.m2\repository\com\google\api-client\google-api-client.25.0\google-api-client-1.25.0.jar;C:\Users\********\.m2\repository\com\google\oauth-client\google-oauth-client.25.0\google-oauth-client-1.25.0.jar;C:\Users\********\.m2\repository\com\google\api-client\google-api-client-appengine.25.0\google-api-client-appengine-1.25.0.jar;C:\Users\********\.m2\repository\com\google\oauth-client\google-oauth-client-appengine.25.0\google-oauth-client-appengine-1.25.0.jar;C:\Users\********\.m2\repository\com\google\oauth-client\google-oauth-client-servlet.25.0\google-oauth-client-servlet-1.25.0.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client-jdo.25.0\google-http-client-jdo-1.25.0.jar;C:\Users\********\.m2\repository\com\google\api-client\google-api-client-servlet.25.0\google-api-client-servlet-1.25.0.jar;C:\Users\********\.m2\repository\javax\servlet\servlet-api.5\servlet-api-2.5.jar;C:\Users\********\.m2\repository\javax\jdo\jdo2-api.3-eb\jdo2-api-2.3-eb.jar;C:\Users\********\.m2\repository\javax\transaction\transaction-api.1\transaction-api-1.1.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client-appengine.25.0\google-http-client-appengine-1.25.0.jar;C:\Users\********\.m2\repository\com\google\code\findbugs\jsr305.0.1\jsr305-3.0.1.jar;C:\Users\********\.m2\repository\commons-fileupload\commons-fileupload.3.3\commons-fileupload-1.3.3.jar;C:\Users\********\.m2\repository\commons-io\commons-io.2\commons-io-2.2.jar;C:\Users\********\.m2\repository\io\swagger\swagger-models.5.9\swagger-models-1.5.9.jar;C:\Users\********\.m2\repository\io\swagger\swagger-annotations.5.9\swagger-annotations-1.5.9.jar;C:\Users\********\.m2\repository\io\swagger\swagger-core.5.9\swagger-core-1.5.9.jar;C:\Users\********\.m2\repository\org\apache\commons\commons-lang3.10\commons-lang3-3.10.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-joda.11.0\jackson-datatype-joda-2.11.0.jar;C:\Users\********\.m2\repository\joda-time\joda-time.9.9\joda-time-2.9.9.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml.11.0\jackson-dataformat-yaml-2.11.0.jar;C:\Users\********\.m2\repository\javax\validation\validation-api.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\********\.m2\repository\org\slf4j\slf4j-nop.7.30\slf4j-nop-1.7.30.jar;C:\Users\********\.m2\repository\com\google\endpoints\endpoints-management-control-appengine-all.0.12\endpoints-management-control-appengine-all-1.0.12.jar;C:\Users\********\.m2\repository\com\google\appengine\appengine-api-1.0-sdk.9.80\appengine-api-1.0-sdk-1.9.80.jar;C:\Users\********\.m2\repository\javax\inject\javax.inject\javax.inject-1.jar;C:\Users\********\.m2\repository\org\projectlombok\lombok.18.12\lombok-1.18.12.jar;C:\Users\********\Projects\********\target\classes, -w, C:\Users\********\Projects\********\src\main\webapp, -h, course-gen.appspot.com]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.725 s
[INFO] Finished at: 2020-06-08T15:59:58-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:endpoints-framework-maven-plugin:2.0.1:openApiDocs (default-cli) on project rest: Endpoints Tool Error: xyz.********.rest.CourseApi -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:endpoints-framework-maven-plugin:2.0.1:openApiDocs (default-cli) on project rest: Endpoints Tool Error
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:305)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:567)
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: org.apache.maven.plugin.MojoExecutionException: Endpoints Tool Error
at com.google.cloud.tools.maven.endpoints.framework.OpenApiDocsMojo.execute (OpenApiDocsMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:305)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:567)
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: xyz.*********.rest.api.CourseApi
at java.net.URLClassLoader.findClass (URLClassLoader.java:436)
at java.lang.ClassLoader.loadClass (ClassLoader.java:588)
at java.lang.ClassLoader.loadClass (ClassLoader.java:521)
at com.google.api.server.spi.tools.GetOpenApiDocAction.loadClasses (GetOpenApiDocAction.java:139)
at com.google.api.server.spi.tools.GetOpenApiDocAction.genOpenApiDoc (GetOpenApiDocAction.java:111)
at com.google.api.server.spi.tools.GetOpenApiDocAction.execute (GetOpenApiDocAction.java:82)
at com.google.api.server.spi.tools.EndpointsTool.execute (EndpointsTool.java:84)
at com.google.cloud.tools.maven.endpoints.framework.OpenApiDocsMojo.execute (OpenApiDocsMojo.java:95)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:305)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:567)
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)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
IntelliJ 将其识别为路径并在我四处移动时自动重构它。有问题的路径在 web.xml
中定义。 (servlet -> init-param -> param-value)
web.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- Wrap the backend with Endpoints Frameworks v2. -->
<servlet>
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>xyz.********.rest.api.CourseApi</param-value>
</init-param>
</servlet>
<!-- Route API method requests to the backend. -->
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- [START api_management] -->
<!-- Add a filter that fetches the service config from service management. -->
<filter>
<filter-name>endpoints-api-configuration</filter-name>
<filter-class>com.google.api.control.ServiceManagementConfigFilter</filter-class>
</filter>
<!-- Add a filter that performs Endpoints logging and monitoring. -->
<filter>
<filter-name>endpoints-api-controller</filter-name>
<filter-class>com.google.api.control.extensions.appengine.GoogleAppEngineControlFilter</filter-class>
<init-param>
<param-name>endpoints.projectId</param-name>
<param-value>${endpoints.project.id}</param-value>
</init-param>
<init-param>
<param-name>endpoints.serviceName</param-name>
<param-value>${endpoints.project.id}.appspot.com</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>endpoints-api-configuration</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>endpoints-api-controller</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
<!-- [END api_management] -->
</web-app>
编辑:想通了
答案很简单 - mvn endpoints-framework:openApiDocs
只能看到由 mvn package
构建的存储库的最新版本(我假设它在目标或其他东西中)。
所以我更新了我的代码,但从未重新运行 mvn package
,所以这就是找不到 class 的原因。
我正处于 GCP openapi guide 的后续步骤,我必须 运行 maven 命令来生成 openapi.json
文件。
我正在关注我自己的项目,所以这可能会或不会通过分叉 example repository 来重现。 (所以我不会,因为我 link 下面是我自己的)
所以当我 运行 他们告诉我的命令时,我得到以下堆栈跟踪,抱怨他们找不到我的 api class,当它非常清楚存在。
C:\Users\********\Projects\********>mvn endpoints-framework:openApiDocs -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< xyz.********:rest >-------------------------
[INFO] Building rest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- endpoints-framework-maven-plugin:2.0.1:openApiDocs (default-cli) @ rest ---
[INFO] Endpoints Tool params : [get-openapi-doc, -o, C:\Users\********\Projects\********\target\openapi-docs\openapi.json, -cp, C:\Users\********\Projects\********\target\classes;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot.3.0.RELEASE\spring-boot-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-core.2.6.RELEASE\spring-core-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-jcl.2.6.RELEASE\spring-jcl-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-context.2.6.RELEASE\spring-context-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-aop.2.6.RELEASE\spring-aop-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-beans.2.6.RELEASE\spring-beans-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-expression.2.6.RELEASE\spring-expression-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot-autoconfigure.3.0.RELEASE\spring-boot-autoconfigure-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot-starter.3.0.RELEASE\spring-boot-starter-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\boot\spring-boot-starter-logging.3.0.RELEASE\spring-boot-starter-logging-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\ch\qos\logback\logback-classic.2.3\logback-classic-1.2.3.jar;C:\Users\********\.m2\repository\ch\qos\logback\logback-core.2.3\logback-core-1.2.3.jar;C:\Users\********\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j.13.2\log4j-to-slf4j-2.13.2.jar;C:\Users\********\.m2\repository\org\apache\logging\log4j\log4j-api.13.2\log4j-api-2.13.2.jar;C:\Users\********\.m2\repository\org\slf4j\jul-to-slf4j.7.30\jul-to-slf4j-1.7.30.jar;C:\Users\********\.m2\repository\jakarta\annotation\jakarta.annotation-api.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\********\.m2\repository\org\yaml\snakeyaml.26\snakeyaml-1.26.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-starter-data-firestore.2.3.RELEASE\spring-cloud-gcp-starter-data-firestore-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-starter.2.3.RELEASE\spring-cloud-gcp-starter-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-core.2.3.RELEASE\spring-cloud-gcp-core-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\com\google\cloud\google-cloud-core.93.4\google-cloud-core-1.93.4.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-iam-v1[=12=].13.0\proto-google-iam-v1-0.13.0.jar;C:\Users\********\.m2\repository\com\google\auth\google-auth-library-oauth2-http[=12=].20.0\google-auth-library-oauth2-http-0.20.0.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-autoconfigure.2.3.RELEASE\spring-cloud-gcp-autoconfigure-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\cloud\spring-cloud-gcp-data-firestore.2.3.RELEASE\spring-cloud-gcp-data-firestore-1.2.3.RELEASE.jar;C:\Users\********\.m2\repository\io\projectreactor\reactor-core.3.5.RELEASE\reactor-core-3.3.5.RELEASE.jar;C:\Users\********\.m2\repository\org\reactivestreams\reactive-streams.0.3\reactive-streams-1.0.3.jar;C:\Users\********\.m2\repository\com\google\cloud\google-cloud-firestore.33.0\google-cloud-firestore-1.33.0.jar;C:\Users\********\.m2\repository\com\google\cloud\google-cloud-core-grpc.93.4\google-cloud-core-grpc-1.93.4.jar;C:\Users\********\.m2\repository\io\grpc\grpc-core.28.1\grpc-core-1.28.1.jar;C:\Users\********\.m2\repository\com\google\android\annotations.1.1.4\annotations-4.1.1.4.jar;C:\Users\********\.m2\repository\io\perfmark\perfmark-api[=12=].19.0\perfmark-api-0.19.0.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-cloud-firestore-admin-v1.33.0\proto-google-cloud-firestore-admin-v1-1.33.0.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-cloud-firestore-v1.33.0\proto-google-cloud-firestore-v1-1.33.0.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-cloud-firestore-v1beta1[=12=].86.0\proto-google-cloud-firestore-v1beta1-0.86.0.jar;C:\Users\********\.m2\repository\com\google\auto\value\auto-value-annotations.7\auto-value-annotations-1.7.jar;C:\Users\********\.m2\repository\io\opencensus\opencensus-contrib-grpc-util[=12=].24.0\opencensus-contrib-grpc-util-0.24.0.jar;C:\Users\********\.m2\repository\com\google\api\api-common.9.0\api-common-1.9.0.jar;C:\Users\********\.m2\repository\io\grpc\grpc-protobuf.28.1\grpc-protobuf-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-protobuf-lite.28.1\grpc-protobuf-lite-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-context.28.1\grpc-context-1.28.1.jar;C:\Users\********\.m2\repository\com\google\protobuf\protobuf-java.11.4\protobuf-java-3.11.4.jar;C:\Users\********\.m2\repository\com\google\api\grpc\proto-google-common-protos.17.0\proto-google-common-protos-1.17.0.jar;C:\Users\********\.m2\repository\com\google\api\gax.56.0\gax-1.56.0.jar;C:\Users\********\.m2\repository\io\grpc\grpc-api.28.1\grpc-api-1.28.1.jar;C:\Users\********\.m2\repository\com\google\errorprone\error_prone_annotations.3.4\error_prone_annotations-2.3.4.jar;C:\Users\********\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations.18\animal-sniffer-annotations-1.18.jar;C:\Users\********\.m2\repository\com\google\api\gax-grpc.56.0\gax-grpc-1.56.0.jar;C:\Users\********\.m2\repository\io\grpc\grpc-auth.28.1\grpc-auth-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-netty-shaded.28.1\grpc-netty-shaded-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-alts.28.1\grpc-alts-1.28.1.jar;C:\Users\********\.m2\repository\io\grpc\grpc-grpclb.28.1\grpc-grpclb-1.28.1.jar;C:\Users\********\.m2\repository\org\conscrypt\conscrypt-openjdk-uber.2.1\conscrypt-openjdk-uber-2.2.1.jar;C:\Users\********\.m2\repository\org\threeten\threetenbp.4.3\threetenbp-1.4.3.jar;C:\Users\********\.m2\repository\io\grpc\grpc-stub.28.1\grpc-stub-1.28.1.jar;C:\Users\********\.m2\repository\io\opencensus\opencensus-api[=12=].24.0\opencensus-api-0.24.0.jar;C:\Users\********\.m2\repository\com\google\auth\google-auth-library-credentials[=12=].20.0\google-auth-library-credentials-0.20.0.jar;C:\Users\********\.m2\repository\com\google\code\gson\gson.8.6\gson-2.8.6.jar;C:\Users\********\.m2\repository\com\google\protobuf\protobuf-java-util.11.4\protobuf-java-util-3.11.4.jar;C:\Users\********\.m2\repository\javax\annotation\javax.annotation-api.3.2\javax.annotation-api-1.3.2.jar;C:\Users\********\.m2\repository\com\google\api\grpc\grpc-google-cloud-firestore-v1.33.0\grpc-google-cloud-firestore-v1-1.33.0.jar;C:\Users\********\.m2\repository\org\springframework\data\spring-data-commons.3.0.RELEASE\spring-data-commons-2.3.0.RELEASE.jar;C:\Users\********\.m2\repository\org\springframework\spring-tx.2.6.RELEASE\spring-tx-5.2.6.RELEASE.jar;C:\Users\********\.m2\repository\org\slf4j\slf4j-api.7.30\slf4j-api-1.7.30.jar;C:\Users\********\.m2\repository\com\google\endpoints\endpoints-framework.2.1\endpoints-framework-2.2.1.jar;C:\Users\********\.m2\repository\com\google\guava\guava.0\guava-20.0.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\core\jackson-annotations.11.0\jackson-annotations-2.11.0.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\core\jackson-core.11.0\jackson-core-2.11.0.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\core\jackson-databind.11.0\jackson-databind-2.11.0.jar;C:\Users\********\.m2\repository\com\google\flogger\flogger[=12=].3.1\flogger-0.3.1.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client-jackson2.25.0\google-http-client-jackson2-1.25.0.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client.25.0\google-http-client-1.25.0.jar;C:\Users\********\.m2\repository\org\apache\httpcomponents\httpclient.5.12\httpclient-4.5.12.jar;C:\Users\********\.m2\repository\org\apache\httpcomponents\httpcore.4.13\httpcore-4.4.13.jar;C:\Users\********\.m2\repository\commons-codec\commons-codec.14\commons-codec-1.14.jar;C:\Users\********\.m2\repository\com\google\j2objc\j2objc-annotations.1\j2objc-annotations-1.1.jar;C:\Users\********\.m2\repository\com\google\api-client\google-api-client.25.0\google-api-client-1.25.0.jar;C:\Users\********\.m2\repository\com\google\oauth-client\google-oauth-client.25.0\google-oauth-client-1.25.0.jar;C:\Users\********\.m2\repository\com\google\api-client\google-api-client-appengine.25.0\google-api-client-appengine-1.25.0.jar;C:\Users\********\.m2\repository\com\google\oauth-client\google-oauth-client-appengine.25.0\google-oauth-client-appengine-1.25.0.jar;C:\Users\********\.m2\repository\com\google\oauth-client\google-oauth-client-servlet.25.0\google-oauth-client-servlet-1.25.0.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client-jdo.25.0\google-http-client-jdo-1.25.0.jar;C:\Users\********\.m2\repository\com\google\api-client\google-api-client-servlet.25.0\google-api-client-servlet-1.25.0.jar;C:\Users\********\.m2\repository\javax\servlet\servlet-api.5\servlet-api-2.5.jar;C:\Users\********\.m2\repository\javax\jdo\jdo2-api.3-eb\jdo2-api-2.3-eb.jar;C:\Users\********\.m2\repository\javax\transaction\transaction-api.1\transaction-api-1.1.jar;C:\Users\********\.m2\repository\com\google\http-client\google-http-client-appengine.25.0\google-http-client-appengine-1.25.0.jar;C:\Users\********\.m2\repository\com\google\code\findbugs\jsr305.0.1\jsr305-3.0.1.jar;C:\Users\********\.m2\repository\commons-fileupload\commons-fileupload.3.3\commons-fileupload-1.3.3.jar;C:\Users\********\.m2\repository\commons-io\commons-io.2\commons-io-2.2.jar;C:\Users\********\.m2\repository\io\swagger\swagger-models.5.9\swagger-models-1.5.9.jar;C:\Users\********\.m2\repository\io\swagger\swagger-annotations.5.9\swagger-annotations-1.5.9.jar;C:\Users\********\.m2\repository\io\swagger\swagger-core.5.9\swagger-core-1.5.9.jar;C:\Users\********\.m2\repository\org\apache\commons\commons-lang3.10\commons-lang3-3.10.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-joda.11.0\jackson-datatype-joda-2.11.0.jar;C:\Users\********\.m2\repository\joda-time\joda-time.9.9\joda-time-2.9.9.jar;C:\Users\********\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml.11.0\jackson-dataformat-yaml-2.11.0.jar;C:\Users\********\.m2\repository\javax\validation\validation-api.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\********\.m2\repository\org\slf4j\slf4j-nop.7.30\slf4j-nop-1.7.30.jar;C:\Users\********\.m2\repository\com\google\endpoints\endpoints-management-control-appengine-all.0.12\endpoints-management-control-appengine-all-1.0.12.jar;C:\Users\********\.m2\repository\com\google\appengine\appengine-api-1.0-sdk.9.80\appengine-api-1.0-sdk-1.9.80.jar;C:\Users\********\.m2\repository\javax\inject\javax.inject\javax.inject-1.jar;C:\Users\********\.m2\repository\org\projectlombok\lombok.18.12\lombok-1.18.12.jar;C:\Users\********\Projects\********\target\classes, -w, C:\Users\********\Projects\********\src\main\webapp, -h, course-gen.appspot.com]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.725 s
[INFO] Finished at: 2020-06-08T15:59:58-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:endpoints-framework-maven-plugin:2.0.1:openApiDocs (default-cli) on project rest: Endpoints Tool Error: xyz.********.rest.CourseApi -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:endpoints-framework-maven-plugin:2.0.1:openApiDocs (default-cli) on project rest: Endpoints Tool Error
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:305)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:567)
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: org.apache.maven.plugin.MojoExecutionException: Endpoints Tool Error
at com.google.cloud.tools.maven.endpoints.framework.OpenApiDocsMojo.execute (OpenApiDocsMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:305)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:567)
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: xyz.*********.rest.api.CourseApi
at java.net.URLClassLoader.findClass (URLClassLoader.java:436)
at java.lang.ClassLoader.loadClass (ClassLoader.java:588)
at java.lang.ClassLoader.loadClass (ClassLoader.java:521)
at com.google.api.server.spi.tools.GetOpenApiDocAction.loadClasses (GetOpenApiDocAction.java:139)
at com.google.api.server.spi.tools.GetOpenApiDocAction.genOpenApiDoc (GetOpenApiDocAction.java:111)
at com.google.api.server.spi.tools.GetOpenApiDocAction.execute (GetOpenApiDocAction.java:82)
at com.google.api.server.spi.tools.EndpointsTool.execute (EndpointsTool.java:84)
at com.google.cloud.tools.maven.endpoints.framework.OpenApiDocsMojo.execute (OpenApiDocsMojo.java:95)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:305)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:567)
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)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
IntelliJ 将其识别为路径并在我四处移动时自动重构它。有问题的路径在 web.xml
中定义。 (servlet -> init-param -> param-value)
web.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- Wrap the backend with Endpoints Frameworks v2. -->
<servlet>
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>xyz.********.rest.api.CourseApi</param-value>
</init-param>
</servlet>
<!-- Route API method requests to the backend. -->
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- [START api_management] -->
<!-- Add a filter that fetches the service config from service management. -->
<filter>
<filter-name>endpoints-api-configuration</filter-name>
<filter-class>com.google.api.control.ServiceManagementConfigFilter</filter-class>
</filter>
<!-- Add a filter that performs Endpoints logging and monitoring. -->
<filter>
<filter-name>endpoints-api-controller</filter-name>
<filter-class>com.google.api.control.extensions.appengine.GoogleAppEngineControlFilter</filter-class>
<init-param>
<param-name>endpoints.projectId</param-name>
<param-value>${endpoints.project.id}</param-value>
</init-param>
<init-param>
<param-name>endpoints.serviceName</param-name>
<param-value>${endpoints.project.id}.appspot.com</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>endpoints-api-configuration</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>endpoints-api-controller</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
<!-- [END api_management] -->
</web-app>
编辑:想通了
答案很简单 - mvn endpoints-framework:openApiDocs
只能看到由 mvn package
构建的存储库的最新版本(我假设它在目标或其他东西中)。
所以我更新了我的代码,但从未重新运行 mvn package
,所以这就是找不到 class 的原因。