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

Avoid using mavenLocal() in build.gradle? #16863

Merged
merged 2 commits into from
Dec 18, 2021
Merged

Avoid using mavenLocal() in build.gradle? #16863

merged 2 commits into from
Dec 18, 2021

Conversation

nickshoe
Copy link
Contributor

@nickshoe nickshoe commented Oct 28, 2021

Overview of the feature request

While reading the Gradle documentation to configure Gradle to use my private Nexus repository, I ran into this advice in the official documentation regarding maven repositories:

As a general advice, you should avoid adding mavenLocal() as a repository...

Existing code:

repositories {
mavenLocal()
mavenCentral()

Motivation for or Use Case

As stated in the doc's chapter "Obtaining module metadata":

  • Each repository is inspected in order.
    • Depending on the type of repository, Gradle looks for metadata files describing the module (.module, .pom or ivy.xml file) or directly for artifact files.
    • Modules that have a module metadata file (.module, .pom or ivy.xml file) are preferred over modules that have an artifact file only.
    • Once a repository returns a metadata result, following repositories are ignored.

(penultimate point)

  • All of the artifacts for the module are then requested from the same repository that was chosen in the process above.

(callout)

The penultimate point above is what can make the integration with Maven Local problematic. As it is a cache for Maven, it will sometimes miss some artifacts of a given module. If Gradle is sourcing such a module from Maven Local, it will consider the missing artifacts to be missing altogether.

Related issues or PR
  • Checking this box is mandatory (this is just to show you read everything)

@nickshoe nickshoe changed the title Avoid using mavenLocal() in gradle.build? Avoid using mavenLocal() in build.gradle? Oct 28, 2021
@atomfrede
Copy link
Member

Yes, I in fact thought we removed it already.

@nickshoe
Copy link
Contributor Author

Ok, I'll make the PR.

@nickshoe nickshoe closed this Oct 28, 2021
@nickshoe nickshoe reopened this Oct 28, 2021
@nickshoe nickshoe changed the base branch from master to main October 28, 2021 13:40
@nickshoe
Copy link
Contributor Author

Sorry for the mess, I've used hub cli and it created the PR against the old "master" branch. Now it's against "main".

@nickshoe
Copy link
Contributor Author

I've tried to regenerate snapshots, but for some reason it changes a lot of files due to different convention for strings and escaping chars (maybe it's related to WSL2 usage). I've destroyed the last commit and force pushed the only commit containing the actual code.

@mshima
Copy link
Member

mshima commented Nov 17, 2021

JHipster uses mavenLocal() for jhipster-bom at CI.
Would require us to start using snapshots (https://github.com/orgs/jhipster/packages?repo_name=jhipster-bom) instead.

@nickshoe
Copy link
Contributor Author

Hey @mshima I'm new to CI concepts and practices.. ':D
Can you point me to an explanation/tutorial of what jhipster-bom and snapshots are?
Let me know if I can do something to this PR.
Thanks

@atomfrede
Copy link
Member

Ah you are right @mshima . Didn't remember why we kept it.

Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
@mshima
Copy link
Member

mshima commented Dec 17, 2021

@atomfrede what do you think about this now?

@atomfrede
Copy link
Member

Sorry missed the review request.

@mshima mshima merged commit 6e01a89 into jhipster:main Dec 18, 2021
@pascalgrimaud pascalgrimaud added this to the 7.5.0 milestone Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants