Warn when recipe artifacts resolve from Maven Central - #459
Open
timtebeek wants to merge 1 commit into
Open
Conversation
New recipe releases go to the Code Genome Project, so a dynamic version resolved against Maven Central silently pins to the last release published there. Point those users at CGP without failing the build. Fixes #458
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.
What
When the
rewriteconfiguration asks for an OpenRewrite/Moderne recipe artifact with a dynamic version (latest.release,1.+,[1.0,2.0), …) and the only repository that can serve it is the real Maven Central, the plugin now logs a warning pointing at the Code Genome Project:Informational only — resolution is untouched and the build still succeeds.
Acceptance criteria
repo.maven.apache.org/repo1.maven.org/repo2.maven.orgcount as Maven Central; a mirror URL doesn't. A repository whose host containscodegenomesuppresses the warning outrightDesign notes / open questions
ResolutionResultAPI exposes no repository origin (ResolvedComponentResulthas nogetRepositoryName()), and the plugin supports Gradle back to 4.10, so reaching into internals wasn't attractive. Declared-repository inspection is a heuristic, but it's the conservative direction: an unknown repository set (e.g. repositories declared insettings.gradleviadependencyResolutionManagement, whereproject.getRepositories()is empty) produces no warning rather than a false one.rewrite-coreet al. are not checked — those are pinned by the plugin and move with a plugin upgrade. Only user-declaredrewriteconfiguration dependencies are considered "recipe artifacts". Let me know if the bundled ones should warn too.https://codegenomeproject.org/tokenis the sign-in/build-configuration page; if there's a dedicated docs page for obtaining credentials, that's probably the better link.Testing
CodeGenomeProjectWarningTest— unit tests over the detection rule (dynamic selectors, Moderne groups, pinned versions, unrelated groups, internal mirror, CGP configured, no visible repositories).StaleRecipeArtifactTest— TestKit functional tests asserting the warning shows up onrewriteDiscoverfor alatest.releaserecipe and stays quiet for a pinned one.