Repository navigation
Fix repository filename lookup without a directory - #252
Open
akashchamp wants to merge 2 commits into
Open
akashchamp wants to merge 2 commits into
akashchamp wants to merge 2 commits into
Conversation
elharo
requested changes
Sep 15, 2026
akashchamp
force-pushed
the
fix/repository-filename-without-directory
branch
from
September 20, 2026 15:36
1e160d8 to
27078d6
Compare
akashchamp
force-pushed
the
fix/repository-filename-without-directory
branch
from
October 8, 2026 18:44
27078d6 to
3b72fe0
Compare
Use Path file-name extraction so a local repository manager may return either a bare filename or a nested repository path.
Keep getRepositoryFilename() private with its original signature so the change is limited to the filename extraction, and replace the unit test that was coupled to the implementation with an invoker integration test. The compare-flat-local-repository IT uses a core extension, built by the setup-flat-local-repository project, that wraps the default local repository manager so getPathForLocalArtifact() returns a bare filename without any directory on the rebuild. Without the fix, artifact:compare fails with StringIndexOutOfBoundsException.
akashchamp
force-pushed
the
fix/repository-filename-without-directory
branch
from
October 9, 2026 19:43
3b72fe0 to
720d9b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #248
What and why
CompareMojo.getRepositoryFilename()assumes the local repository manager always returns a path containing/and slices the string at the last separator. A local repository manager may return a bare filename instead, which makespath.substring(path.lastIndexOf('/'))throwStringIndexOutOfBoundsExceptionbefore the comparison result is written. UsePathfile-name extraction so both bare filenames and nested repository paths resolve to the artifact filename.Validation
compare-flat-local-repository: asetup-flat-local-repositoryproject builds a small core extension that wraps the default local repository manager sogetPathForLocalArtifact()returns a bare filename (activated with-DflatLocalRepository=trueon the rebuild only). The IT installs a reference build, rebuilds with the flat layout and runsartifact:compare;verify.groovychecks that the extension was active, that noStringIndexOutOfBoundsExceptionoccurred and that the expected.buildcompare(with thediffoscopehint) was written. Without the fix the IT fails with the exception from compare: getRepositoryFilename crashes on path without '/' #248.mvn verifypassed.mvn -Prun-its verifypassed with Maven 3.9.16; the new IT also passes with Maven 3.10.0-rc-1 and Maven 4.0.0-rc-6.Checklist
mvn verifypassed.mvn -Prun-its verifypassed.