full-stack-professional
full-stack-professional copied to clipboard
Configuring Jib plugin - the issue with mvn clean package
There is a couple of things to be aware of:
- you need to use ${project.organization.name}
- It won't build and push an image if you don't specify the executions
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
The complete plugin part:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<from>
<image>eclipse-temurin:20-jre</image>
<platforms>
<platform>
<architecture>arm64</architecture>
<os>linux</os>
</platform>
<platform>
<architecture>amd64</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
<to>
<image>docker.io/${project.organization.name}/${project.artifactId}:${project.version}</image>
<tags>
<tag>latest</tag>
</tags>
</to>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
Now, you're good to go with mvn clean package