GoogleContainerTools / GoogleContainerTools/jib
jib plugin warnings with Maven 3.9.x
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Environment**:
- *Jib version:* 3.3.2, 3.3.3-SNAPSHOT
- *Build tool:* Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c)
- *OS:* OS name: "mac os x", version: "13.4", arch: "aarch64", family: "mac"
**Description of the issue**:
running a build with `-Dmaven.plugin.validation=VERBOSE` results in
```
[WARNING] * com.google.cloud.tools:jib-maven-plugin:3.3.3-SNAPSHOT
[WARNING] Declared at location(s):
[WARNING] * ...
[WARNING] Used in module(s):
[WARNING] * ...
[WARNING] Plugin issue(s):
[WARNING] * Plugin should declare these Maven artifacts in `provided` scope: [org.apache.maven:maven-builder-support:3.9.1, org.apache.maven:maven-artifact:3.9.1, org.apache.maven:maven-core:3.9.1, org.apache.maven:maven-plugin-api:3.9.1, org.apache.maven:maven-resolver-provider:3.9.1, org.apache.maven:maven-model-builder:3.9.1, org.apache.maven:maven-repository-metadata:3.9.1, org.apache.maven:maven-settings:3.9.1, org.apache.maven:maven-model:3.9.1, org.apache.maven:maven-settings-builder:3.9.1]
```
which is a warning that Maven started spewing in version 3.9.2 and beyond.
**Expected behavior**:
The maven plugin should not report any warnings.
**Steps to reproduce**:
1. use any project that uses the maven jib plugin
2. use maven 3.9.2 (or better, the behavior is under discussion on maven-dev right now)
3. add `-Dmaven.plugin.validation=VERBOSE` to the command line
**`jib-maven-plugin` Configuration**:
```xml
com.google.cloud.tools
jib-maven-plugin
3.3.3-SNAPSHOT
jib.default
package
dockerBuild
eclipse-temurin:17-alpine@sha256:33c0ef386e85569340e902bc4e7ced80dd43432a22511814a0b066c837a72c52
...
...
server
/config/server.yml
-Duser.timezone=UTC
-Xmx512m
8080
8081
eclipse-temurin:17-alpine@sha256:33c0ef386e85569340e902bc4e7ced80dd43432a22511814a0b066c837a72c52
...
...
server
/config/server.yml
-Duser.timezone=UTC
-Xmx512m
8080
8081
```
**Log output**:
```
[WARNING] * com.google.cloud.tools:jib-maven-plugin:3.3.3-SNAPSHOT
[WARNING] Declared at location(s):
[WARNING] * ...
[WARNING] Used in module(s):
[WARNING] * ...
[WARNING] Plugin issue(s):
[WARNING] * Plugin should declare these Maven artifacts in `provided` scope: [org.apache.maven:maven-builder-support:3.9.1, org.apache.maven:maven-artifact:3.9.1, org.apache.maven:maven-core:3.9.1, org.apache.maven:maven-plugin-api:3.9.1, org.apache.maven:maven-resolver-provider:3.9.1, org.apache.maven:maven-model-builder:3.9.1, org.apache.maven:maven-repository-metadata:3.9.1, org.apache.maven:maven-settings:3.9.1, org.apache.maven:maven-model:3.9.1, org.apache.maven:maven-settings-builder:3.9.1]
```
**Additional Information**:
The problem is pretty straightforward: The maven plugin uses maven APIs and adds those to the `META-INF/maven/plugin.xml` descriptor, e.g.
```
org.apache.maven
maven-plugin-api
jar
3.9.1
```
When building a plugin with maven itself, declaring this as a "provided" dependency in the pom suffices so that the maven plugin tooling sorts that out and omits these dependencies from the `META-INF/maven/plugin.xml` descriptor. For the gradle based build here, this is some combination of dependency declaration in the build.gradle file (I tried compileOnly but that did not work), and the freefair maven plugin (whose [full documentation](https://docs.freefair.io/gradle-plugins/current/reference/#_io_freefair_maven_plugin) consists of the sentence `This Task is the gradle equivalent of the [DescriptorGeneratorMojo](https://maven.apache.org/plugin-tools/maven-plugin-plugin/descriptor-mojo.html) of the [Maven Plugin Maven Plugin](https://maven.apache.org/plugin-tools/maven-plugin-plugin/index.html).`
I would have sent you a PR, but I can not figure out how that works, sorry.
Contributor guide
Assessment
This issue has not been assessed yet.