proposals/archives/maven_configuration_v2.md
jib-maven-plugin configuration with jib-gradle-pluginImplemented in: v0.9.0
jib-gradle-plugin introduced a different configuration schema from jib-maven-plugin. This schema has many benefits over the original jib-maven-plugin configuration. Therefore, to maintain consistency between the two plugins, the jib-maven-plugin configuration should be updated to be more similar to the jib-gradle-plugin configuration.
jib-maven-plugin configuration be as similar to jib-gradle-plugin configuration as possiblejib-maven-plugin (we are still in alpha)The current jib-maven-plugin configuration looks like:
<configuration>
<from>openjdk:alpine</from>
<registry>localhost:5000</registry>
<repository>my-image</repository>
<tag>built-with-jib</tag>
<credHelpers>
<credHelper>osxkeychain</credHelper>
</credHelpers>
<jvmFlags>
<jvmFlag>-Xms512m</jvmFlag>
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Xmy:flag=jib-rules</jvmFlag>
</jvmFlags>
<mainClass>mypackage.MyApp</mainClass>
<enableReproducibleBuilds>true</enableReproducibleBuilds>
<imageFormat>OCI</imageFormat>
</configuration>
And the current jib-gradle-plugin configuration looks like:
jib {
from {
image = 'openjdk:alpine'
}
to {
image = 'localhost:5000/my-image/built-with-jib'
credHelper = 'osxkeychain'
}
jvmFlags = ['-Xms512m', '-Xdebug', '-Xmy:flag=jib-rules']
mainClass = 'mypackage.MyApp'
reproducible = true
format = 'OCI'
}
Therefore, the desired jib-maven-plugin configuration should look like:
<configuration>
<from>
<image>openjdk:alpine</image>
</from>
<to>
<image>gcr.io/my-gcp-project/my-app</image>
<credHelper>gcr</credHelper>
</to>
<jvmFlags>
<jvmFlag>-Xmy:flag=jib-rules</jvmFlag>
</jvmFlags>
<mainClass>mypackage.MyApp</mainClass>
<reproducible>true</reproducible>
<format>OCI</format>
</configuration>
The key changes are:
registry, repository, and tag - these are now defined as one field to.image.to - the image reference, andcredHelper - the credential helper for that imagefrom) and the target image (to).enableReproducibleBuilds is renamed to reproducible.imageFormat is renamed to format.BuildConfiguration to individual credHelpers for the base and target images, not as a list.BuildImageMojo (and DockerContextMojo) schema.to.image.