微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

包 org.threeten.bp 或 com.google.gson 不存在

如何解决包 org.threeten.bp 或 com.google.gson 不存在

我正在使用 codegen maven 插件并且现在生成代码。我正在使用 java 8。但我无法运行

maven install

由于缺少一些包。 这是我添加swagger-codegen-maven-plugin。这很好构建 jar。

            <plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>3.0.26</version>
                <configuration>
                    <configOptions>
                        <sourceFolder>./generated-sources/</sourceFolder>
                        <java8>true</java8>
                        <interfaceOnly>true</interfaceOnly>
                    </configOptions>
                    <output>${project.build.directory}/</output>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>./src/main/resources/api-contract/first.json</inputSpec>
                            <language>spring</language>
                            <configOptions>
                                <apiPackage>com.service.api</apiPackage>
                                <modelPackage>com.service.model</modelPackage>
                                <invokerPackage>com.service.handler</invokerPackage>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

但是,如果我将语言更改为

                            <language>java</language>

并运行 maven 安装。代码仍然可以下载,但会弹出编译错误

package com.google.gson does not exist 

另外,如果我将语言更改为

                            <language>java</language>
                            <library>restemplate</library>

并运行 maven 安装。代码还是可以下载的,但是这次又出现编译错误

package org.threeten.bp does not exist
package com.fasterxml.jackson.datatype.threetenbp does not exist

因为我只是想跟随 https://www.youtube.com/watch?v=QQaFKGU8oi4 但我不确定为什么我会收到这个错误以及如何解决它。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。