apache / apache/maven

[MNG-7853] Support Gradle Module Metadata

Open
#9,067 1 comment 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Vladimir Sitnikov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=vladimirsitnikov)** opened **[MNG-7853](https://issues.apache.org/jira/browse/MNG-7853?redirect=false)** and commented

Currently, Maven lacks ability to describe and consume metadata for the artifacts.

I suggest Maven should use Gradle Module Metadata format for both publication and consumption.

Note: Gradle Module Metadata does not require Gradle, and it is a generic format describing artifacts and attributes.

For instance, if somebody publishes "artifact with classifier", then Maven can't express what stands behind the artifact, and there's no way to add a dependency without mentioning the classifier explicitly.

There are cases when hard-coding artifact names is not workable:
* jars targeted for different JDK versions: -jre8.jar
* jars targeted for different Operating Systems: -linux, -windows, -...
* test jars: -tests.jar

All of the above have no metadata, so the ones who consume the jars can't just ask "I need a Java 11 compatible artifact for macOS ARM". With Maven the only possibility is to hard-code the classifier name, and the classifiers are different across projects.

Gradle Module Metadata enables publishers to describe the set of published artifacts, so it is easier to consume.

 

For instance, Guava uses versions like 28.1-android, 28.0-jre, and 26.0-android. It is a workaround to overcome the lack of metadata handling in Maven dependency resolution.

It would be way better for the end users to declare "guava version they need like 28.1", and "target platform they need like java 11". Then Maven should resolve all the dependencies according to the requested attributes, so Maven could resolve the appropriate classifiers for the dependencies. Ideally, the use of explicit classifiers in dependency declaration should be deprecated.

---

**Issue Links:**
- [MNG-5652](https://issues.apache.org/jira/browse/MNG-5652) "supplies"/"provides"/"proffers" concept proposal

1 votes, 2 watchers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.