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
feat(maven): lookup parent homepage/scm information from pom #9722
feat(maven): lookup parent homepage/scm information from pom #9722
Conversation
…ation from poms, made sbt use this implementation
…742_mvn_lookup_parents
…arents Merge and resolve conflicts
How I see the roadmap for this PR:
@twendelmuth What do you think? |
Works for me. I tried to touch the SBT related changes as little as possible - so that they also gain the same approach without potentially breaking their functionality. In general I think at least parts of the logic could also make sense in the maven-utils part - however that would have made my changeset even bigger and less readable. The main goal was to be able to pass the repoRoot to the maven-utils function and actually using this (so we don't deviate in handling of maven.poms like we do today). The whole logic of trying different directory structures seem to be a fallback to deal with mistakes that have been made in uploading the maven artifacts. In the public repos usually you'd find a "normal" version anyway though but obviously I cannot speak for internally hosted maven repositories. Examples of this: Anyway. I'd for now split off the commits for sbt and put them in a different branch (if you haven't done that already 😄) |
Okay, just don't spend too much effort on tests for now :) |
So I've split the things off: With the sbt one based on the mvn lookup things. How do you want me to proceed? |
Thanks, okay let's wait until my refactoring is in |
This comment has been minimized.
This comment has been minimized.
@HonkingGoose the refactorings are in. I now need to adapt the tests to run with the new setup, blocking is okay I guess. I could also revert to a draft PR 👼 (#9745) |
I've removed the "blocked" label. I think it's a good idea to mark this PR as a draft again, that way it's clear that more work is still needed before it's in a ready-to-merge state again. |
Hi @twendelmuth, I'm about to adapt your tests for recent test refactoring right now. Once done, we only need to split Maven/Sbt parts |
…742_mvn_lookup_parents
@zharinov I've removed the sbt parts - we can add them in a different PR imo. |
Anything that is missing here? |
Feature 6742 mvn lookup parents
Hi @twendelmuth, sorry for the long delay. Let's do this! |
…ull_guards Handle empty fields
lib/datasource/maven/util.ts
Outdated
const parentDisplayId = `${parentGroupId}:${parentArtifactId}`; | ||
const parentDependency = getDependencyParts(parentDisplayId); | ||
|
||
const parentInformation = await getDependencyInfo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @twendelmuth, thanks for merging my changes. Finally, we need to limit the recursion depth and test it on self-referencing pomfile. I would limit to 5, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 sounds reasonable - I could see certain projects might go a bit deeper than that but it's a good starting point imo.
Regarding the self-reference:
I guess you're referring to circular dependencies like POM1 -> POM2 -> POM1? A POM is not allowed to be it's own parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was a bit lazy for creating circle with 2 participants 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs deconflicting
…2_mvn_lookup_parents
🎉 This PR is included in version 25.51.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Changes:
Changed the way maven is looking up sourceUrl & homepage. It will now also traverse up to the parents to look for this information if not given in the original dependency.
Also updated sbt to make use of the maven dependency lookup instead of trying it's own implementation.
This also led to me taking over the sbt parts of sourceUrl escaping for the maven implementation:
This has been extended to also support
<url>git://github.com/child-scm/child</url>
vs previously only supported<url>git://github.com:child-scm/child</url>
. I had seen this in some poms and thought it makes sense to include this (reference poms are commented in the test poms)Context:
In the java world parent dependency declarations are quiet common. A maven
pom.xml
will always inherit it's parents properties if they're not overridden in the original pom.xml. Since this is the case we're losing information by not parsing this information from the given parents.The downside I see for this is, that we could end up with sourceUrl/homepage of an external framework if that's used as parent and no own scm-url/url information was provided in the
pom.xml
-spring-boot-starter-parent
comes to mind here. I'd however assume that this is mainly an issue that internal libaries might be facing and can easily be mitigated by declaring correct properties for scm-url/url.I wasn't able to test how the gradle implementation handles this since I didn't manage to get this running locally :-/
Closes #6742
PR comparisons
dependency: current code pr -> new code pr (potential comment)
Simple build tool
scala: twendelmuth/twendelmuth-testing-sbt-vanilla#6 -> twendelmuth/twendelmuth-testing-sbt#4 (nothing should have changed here)
ro.nextreports: twendelmuth/twendelmuth-testing-sbt-vanilla#5 -> twendelmuth/twendelmuth-testing-sbt#6 (finds correct source url)
xhtmlrenderer: twendelmuth/twendelmuth-testing-sbt-vanilla#3 -> twendelmuth/twendelmuth-testing-sbt#2 (finds correct source url, can parse github release notes)
maven
maven-compiler: twendelmuth/twendelmuth-testing-mvn-vanilla#4 -> twendelmuth/twendelmuth-testing-mvn#3 (nothing has changed here)
ro.nextreports: twendelmuth/twendelmuth-testing-mvn-vanilla#5 -> twendelmuth/twendelmuth-testing-mvn#5 (finds correct source url)
xhtmlrenderer: twendelmuth/twendelmuth-testing-mvn-vanilla#3 -> twendelmuth/twendelmuth-testing-mvn#2 (finds correct source url, can parse github release notes)
Documentation (please check one with an [x])
How I've tested my work (please tick one)
I have verified these changes via: