Class SiblingRepositoryKeyResolver
- All Implemented Interfaces:
RepositoryKeyResolver
RepositoryKeyResolver backed by sibling checkouts on the
local filesystem (IKE-Network/ike-issues#496 part C).
Scans a base directory of sibling repository checkouts, walks
every pom.xml it finds, and indexes the coordinate the POM
declares against the RepositoryKey of the repository
containing it. Subsequent resolve
calls are constant-time map lookups against the index.
How the repository identity is determined
The repository identity is taken from the root POM of the
containing git repository, not from Maven inheritance. For
each pom.xml found:
- Walk upward to the nearest ancestor directory containing a
.gitentry — the git repo root. - Read that root's
pom.xmlfor its local<scm>block. - Convert the
<scm>URL or connection to aRepositoryKeyviaRepositoryKey.of(String). - Index every coordinate produced under that git repo against this same key.
This bypasses Maven's default <scm> inheritance, which
appends each subproject's <artifactId> to the parent's
URL (producing paths like .../ike-tooling/ike-build-standards
for what is in fact still the ike-tooling repository). The
git-boundary read gives every coordinate in a reactor the same
key — the goal of the cascade's repository-keyed node model.
Scoping
The scan is bounded: it descends from the supplied base
directory but skips target/, .git/, .idea/,
node_modules/, and similar build/IDE caches.
-
Constructor Summary
ConstructorsConstructorDescriptionSiblingRepositoryKeyResolver(Path baseDir) Creates a resolver that lazily indexes the POMs underbaseDiron the firstresolve(MavenCoordinate)call. -
Method Summary
Modifier and TypeMethodDescriptionvoidindex()Indexes the POMs eagerly.resolve(MavenCoordinate coordinate) Returns theRepositoryKeyof the repository that produces a coordinate, or empty if the coordinate cannot be located.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RepositoryKeyResolver
resolve
-
Constructor Details
-
SiblingRepositoryKeyResolver
Creates a resolver that lazily indexes the POMs underbaseDiron the firstresolve(MavenCoordinate)call.- Parameters:
baseDir- the directory of sibling checkouts; required
-
-
Method Details
-
index
public void index()Indexes the POMs eagerly. Optional —resolve(MavenCoordinate)will trigger the same indexing on first call. -
resolve
Description copied from interface:RepositoryKeyResolverReturns theRepositoryKeyof the repository that produces a coordinate, or empty if the coordinate cannot be located.- Specified by:
resolvein interfaceRepositoryKeyResolver- Parameters:
coordinate- the upstream's coordinate- Returns:
- the producing repository's key, or empty if unknown
-