-
Couldn't load subscription status.
- Fork 1.5k
Open
Description
Environment:
- Jib version: 3.4.4
- Build tool: maven 3.9.9
- OS: linux/macos
Description of the issue:
when using the maven remote build cache, the plugin fails to build the jib, either failing with
Obtaining project build output files failed; make sure you have compiled your project before trying to build the image. (Did you accidentally run "mvn clean jib:build" instead of "mvn clean compile jib:build"?)
or when running using <containerizingMode>packaged</containerizingMode>
Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.4:dockerBuild (default) on project xxx: .../target/classes is not a directory
Expected behavior:
I understand that the plugin is relying on the compiled classes to exist when running in containerizingMode=exploded, but the packaged containerizingMode should (as far as i understood) use the existing jar file instead (which is the only thing existing when using a remote build cache)
Steps to reproduce:
- setup a maven project with jib configured and maven build cache extension
- run mvn clean package twice (second time for cache hit)
- error
jib-maven-plugin Configuration:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
<from>
<image>gcr.io/distroless/java21-debian12:nonroot</image>
</from>
<containerizingMode>packaged</containerizingMode>
<to>
<!-- TODO: this image is being pushed to the registry for each build, do we need it there? -->
<image>...</image>
</to>
<container>
<ports>
<port>50051</port>
</ports>
</container>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>dockerBuild</goal>
</goals>
</execution>
</executions>
</plugin>Log output:
Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.4:dockerBuild (default) on project xxx: .../target/classes is not a directory
Additional Information:
- when running maven using a remote cache build, there is no target/classes directory, but a
target/<finalName>-<version>.jarfile