full-stack-professional icon indicating copy to clipboard operation
full-stack-professional copied to clipboard

Configuring Jib plugin - the issue with mvn clean package

Open hazartilirot opened this issue 2 years ago • 0 comments

There is a couple of things to be aware of:

  1. you need to use ${project.organization.name}
  2. 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

hazartilirot avatar Apr 27 '23 09:04 hazartilirot