Java POM中的编译错误,原因是使用openApi生成代码

Java POM中的编译错误,原因是使用openApi生成代码,java,maven,openapi,swagger-codegen,openapi-generator,Java,Maven,Openapi,Swagger Codegen,Openapi Generator,所以我使用的是openApi代码生成器。(所有这些都适用于大摇大摆的codegen,同样的错误) 我在eclipse中创建了一个maven项目,我有一个POM,看起来像这样 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://m

所以我使用的是openApi代码生成器。(所有这些都适用于大摇大摆的codegen,同样的错误)

我在eclipse中创建了一个maven项目,我有一个POM,看起来像这样

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.test.api.openapi</groupId>
  <artifactId>test-openapi-codegen</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>test-openapi-codegen</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
  </properties>
  
  <build>
   <plugins>
    <plugin>
     <groupId>org.openapitools</groupId>
     <artifactId>openapi-generator-maven-plugin</artifactId>
     <version>4.3.1</version>
     <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>${project.basedir}/src/main/resources/openAPI.yaml</inputSpec>
                <generatorName>java</generatorName>
                <apiPackage>com.test.openapi.codegen.demo.api</apiPackage>
                <modelPackage>com.test.openapi.codegen.demo.model</modelPackage>
                <invokerPackage>com.test.openapi.codegen.demo</invokerPackage>
                <configOptions>
                <sourceFolder>src/java/</sourceFolder>
                </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.openapitools</groupId>
      <artifactId>openapi-generator-maven-plugin</artifactId>
      <version>4.3.1</version>
      <scope>provided</scope>
    </dependency> 
  </dependencies>
</project>

我做错了什么?我已经用最好的方式进行了描述。

我通过添加缺少的依赖项修复了问题,但我认为这不是最好的方法,最好使用cli jar来满足需要

从maven central、openapi-codegen-cli.jar下载jar,它是一个可运行的jar,并根据req使用参数

它将从YAML生成一个代码,然后您可以使用生成的POM进行mvn清理安装或任何您想要的操作

 Changes detected - recompiling the module!
    [INFO] Compiling 43 source files to T:\Perforce\testStream\openapi-codegen\target\classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] T:/Perforce/testStream/openapi-codegen/target/generated-sources/openapi/src/java/com/test/openapi/codegen/demo/model/ProvisioningBatch.java:[18,23] package com.google.gson does not exist