1. jib-maven-plugin打包报错:

Cannot find default setter in class com.google.cloud.tools.jib.maven.JibPluginConfiguration$FromConfiguration

原因 : from标签设置不对,改成这种格式(新版本是这样的)

<from>
    <image>ascdc/jdk8</image>
</from>

2.再次报错:没有定义mainclass

报错日志:

Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.2.1:build (default-cli) on project ruoyi-system: Multiple valid main classes were found: xyz.xxdl.life.service.impl.LifeElectricityHi
sServiceImpl, xyz.xxdl.utils.EmailUtils, perhaps you should add a `mainClass` configuration to jib-maven-plugin

解决

 <container>
                        <mainClass>xyz.xxdl.RuoYiApplication</mainClass>
                    </container>

3. 完整配置

   <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                <!-- 配置启动类 -->
                    <container>
                        <mainClass>xyz.xxdl.RuoYiApplication</mainClass>
                    </container>
                    <from>
                        <image>
                            ascdc/jdk8
                        </image>
                      </from>
                    <to>
   <!-- registry.cn-beijing.aliyuncs.com/命名空间/镜像名 -->
                        <image>registry.cn-beijing.aliyuncs.com/xxx/${project.artifactId}:${project.version}</image>
                        <auth>
                            <username>阿里云用户名</username>
                            <password>仓库登录密码(不是阿里云密码)</password>
                        </auth>
                        <tags>
                            <tag>
                                ${project.version}
                            </tag>
                        </tags>
                    </to>

                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>

            </plugin>

​使用 mvn compile jib:build自动打包并上传
在这里插入图片描述

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐