GoogleContainerTools / GoogleContainerTools/jib
Plugin fails when running with maven using remote build cache
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
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](https://maven.apache.org/extensions/maven-build-cache-extension/remote-cache.html), 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 `packaged`
```
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**:
1. setup a maven project with jib configured and maven build cache extension
2. run mvn clean package twice (second time for cache hit)
3. error
**`jib-maven-plugin` Configuration**:
```xml
com.google.cloud.tools
jib-maven-plugin
false
gcr.io/distroless/java21-debian12:nonroot
packaged
...
50051
package
dockerBuild
```
**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/-.jar` file
Contributor guide
Assessment
This issue has not been assessed yet.