[MNG-7471] Make Resolver util and connector-basic provided (#732)

Problem: resolver spi, impl and connector-basic has changes in 1.8.0 (SPI interface RepositoryLayout got new method, that is implemented in connector-basic, and code from impl is using it). But, Maven core exports only resolver api, spi and impl packages, while the rest is at mercy of a plugin. This means ,that these artifacts (api, spi and impl) will always come from Maven core, whatever version plugin declares, while the "rest" (connector-basic and util) will be of version that plugin declares. The current state hence prevented ANY KIND of changes on SPI interfaces that would be implemented in connector-basic (which is the case in Resolver 1.8.0).

Solution: make all these resolver artifacts "provided" (to behave like maven-core or maven-plugin-api is behaving): simply put, whatever resolver artifact plugin depends on, it should NOT use it's own version, but the version from Maven. This ensures that api-spi-impl-connector-basic as "aligned" and are same version.

Details:

The change is to make util is exportedArtifact AND exportedPackage, while connector-basic is only exportedArtifact.

Reasoning:
* exportedArtifact -- prevents "own" artifact to be added to realm
* exportedPackage -- makes it "visible" in realm

So, this basically prevents bad versions of util and connector-basic
enter the plugin realm (as they will be not added to it), while
util remains "visible" to plugins, as the intent was, most
common due GenericVersions etc.

This change also results in simpler expectations to plugin developers:
resolver libraries should really behave like maven-core or maven-compat:
when plugin declares dependency on these (w/ scope provided as best
practice), they really get version of these that are of version that
maven runs in, not version they declare. So same thing happens now with
resolver: you will get same version of resolver that maven uses your plugin
runs in.

Before this change, it was a mixed bag: api, spi and impl was from maven,
while util and connector-basic was version you pulled in as dep.
This commit is contained in:
Tamas Cservenak 2022-05-11 16:09:52 +02:00
parent 1c22f94522
commit a83ed86c48
1 changed files with 5 additions and 0 deletions

View File

@ -72,6 +72,7 @@ under the License.
<exportedPackage>org.eclipse.aether.transfer</exportedPackage>
<exportedPackage>org.eclipse.aether.transform</exportedPackage>
<exportedPackage>org.eclipse.aether.version</exportedPackage>
<exportedPackage>org.eclipse.aether.util</exportedPackage>
<!-- plexus-classworlds -->
<exportedPackage>org.codehaus.plexus.classworlds</exportedPackage>
@ -169,6 +170,8 @@ under the License.
<exportedArtifact>org.apache.maven.resolver:maven-resolver-api</exportedArtifact>
<exportedArtifact>org.apache.maven.resolver:maven-resolver-spi</exportedArtifact>
<exportedArtifact>org.apache.maven.resolver:maven-resolver-impl</exportedArtifact>
<exportedArtifact>org.apache.maven.resolver:maven-resolver-util</exportedArtifact>
<exportedArtifact>org.apache.maven.resolver:maven-resolver-connector-basic</exportedArtifact>
<exportedArtifact>javax.inject:javax.inject</exportedArtifact>
<exportedArtifact>javax.annotation:javax.annotation-api</exportedArtifact>
@ -184,6 +187,8 @@ under the License.
<exportedArtifact>org.eclipse.aether:aether-api</exportedArtifact>
<exportedArtifact>org.eclipse.aether:aether-spi</exportedArtifact>
<exportedArtifact>org.eclipse.aether:aether-impl</exportedArtifact>
<exportedArtifact>org.eclipse.aether:aether-util</exportedArtifact>
<exportedArtifact>org.eclipse.aether:aether-connector-basic</exportedArtifact>
<!--
| NOTE: Don't exclude the wagons or any of their dependencies (apart from the wagon API). This would otherwise