-
Notifications
You must be signed in to change notification settings - Fork 90
Merge scopes when adding a dependency that exists but with different scope #455
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
Comments
Hi @fabapp2 Any takers for this? Otherwise, I will give it a shot. |
HI @ravig-kant ! assigned-to: @ravig-kant |
Hi @fabapp2 Here are my initial thoughts. OpenRewriteMavenBuildFile
Let me know your thoughts. |
The scope is then set to
Why not changing it to compile?
Hi @ravig-kant thanks for looking into it!
Let me know your thoughts. 😃 |
Agree. I meant to say remove from test scope and add to compile.
Sure. Let's do that.
Hi @fabapp2 If we are promoting a dependency from transitive to direct, it should not be an issue. Direct dependencies take precedence over transitive dependencies. Let me know your thoughts. P.S.: My responses will be delayed due to the festivities. |
Hi @fabapp2 While implementing the change, I got some doubts about your proposed change matrix :). The first column represents the scope of the dependency in the current state, while the first row represents the proposed change. For instance, if a dependency is currently in compile scope and it's now being added in provided scope, as per the matrix, the updated pom will have provided scope. Is it correct? Ravi |
Hi @ravig-kant I hope you enjoyed the festivities!
Me too now, I guess we're back to the requirements you initially defined?! 😃 |
Hi @fabapp2 I think I was too eager to make some progress 😅 . I just put together a tiny algorithm which works as below.
You can look at this code which implements this algorithm. I think this algorithm satisfies the asks in this enhancement and can be extended for any future asks. Thanks |
Ha! I like your attitude 💪 I need to look at your code next few days, as being a bit behind due to my vacation. |
Hi @ravig-kant looks nice clean and concise. 🤩 |
Hi @fabapp2 Thanks. I have created a PR. I have changed the AddDependency action instead of creating a new recipe. |
Currently, the implementation will add a dependency with
compile
scope when the same dependency already exists withtest
scope. It should merge these dependencies and set the state accordingly (or throw exception?)Originally posted by @fabapp2 in #309 (comment)
The text was updated successfully, but these errors were encountered: