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
自动打包并上传