Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for local maven repository #248

Open
yokeru opened this issue Sep 11, 2020 · 1 comment
Open

Add support for local maven repository #248

yokeru opened this issue Sep 11, 2020 · 1 comment
Labels
good first issue Good for newcomers. Also see up-for-grabs. problem Something isn't working

Comments

@yokeru
Copy link

yokeru commented Sep 11, 2020

Describe the bug

refreshVersions is not able to find the latest versions of artifact in local maven repository.

To Reproduce

  1. Publish any project/library that uses maven-publish plugin to local maven repository, e.g. via ./gradlew publishToMavenLocal
  2. Use it as a dependency in another project with refreshVersions, specifying the local repository via repositories { mavenLocal() } block.
  3. refreshVersions fails to find any published versions of this artifact in local maven repository.

Expected behavior

refreshVersions should find the latest version of the artifact.

Additional context

This happens due to the fact that publishing to local maven repository creates maven-metadata-local.xml and refreshVersions only checks for maven-metadata.xml (also after renaming of the metadata file, the versions could be found).

Proposed solution

It might be a good idea to use maven-metadata-local.xml as a fallback, if the maven-metadata.xml file is not found, or even better to use it as a primary location, if the repository is a local maven repository (recognizing it e.g. via repoUrl containing a file scheme and path (usually) containing .m2 substring/pattern).

Note: The generic metadata file format for non-remote repositories is maven-metadata-<repo-id>.xml for a repository with repo-id identifier, but this defaults almost always to 'local'.

@yokeru yokeru changed the title Support for local maven repository Add support for local maven repository Sep 11, 2020
@LouisCAD
Copy link
Member

Thanks for the report with the precise information!
That name difference explains my questioning when I didn't see the local version but it worked when adding it manually.

@LouisCAD LouisCAD added problem Something isn't working good first issue Good for newcomers. Also see up-for-grabs. labels Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers. Also see up-for-grabs. problem Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants