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 Maven Parent" recipe #4239

Open
rcsilva83 opened this issue Jun 7, 2024 · 3 comments
Open

"Add Maven Parent" recipe #4239

rcsilva83 opened this issue Jun 7, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request recipe Requested Recipe

Comments

@rcsilva83
Copy link

rcsilva83 commented Jun 7, 2024

What problem are you trying to solve?

I need to add a parent POM to my projects.

Describe the solution you'd like

I'd like a recipe for that as there already has one for changing the Maven parent.

Have you considered any alternatives or workarounds?

Using text recipe

Additional context

Are you interested in contributing this feature to OpenRewrite?

I can try :)

@rcsilva83 rcsilva83 added the enhancement New feature or request label Jun 7, 2024
@timtebeek timtebeek transferred this issue from openrewrite/rewrite-docs Jun 7, 2024
@timtebeek timtebeek added the recipe Requested Recipe label Jun 7, 2024
@timtebeek
Copy link
Contributor

hi @rcsilva83 ! Thanks for the suggestion. For this one I'd assume the implementation would be rather similar to Change Maven Parent

public class ChangeParentPom extends Recipe {

Perhaps we can start with a draft PR with some unit tests, and then I'll help guide you through what's needed beyond that.

Tests are also a great way to think through and codify how you'd want to handle certain cases, like:

  • should we match just any pom.xml file? Or only matching certain criteria?
  • How to handle an existing parent? Is that the same for multi module projects?

@rcsilva83
Copy link
Author

Hi @timtebeek

I'm trying to build the project on my machine but I'm having issues:

A problem occurred configuring project ':tools:language-parser-builder'.
> Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=any, implementation=vendor-specific} for WINDOWS on x86_64.
   > No locally installed toolchains match and toolchain download repositories have not been configured.

I'm running with JDK21 but it I run with JDK17 I have the same problem with languageVersion=21. I'm trying to configure org.gradle.java.installations.paths on gradle.properties but nothing changed...

Can you help me with this?

@timtebeek
Copy link
Contributor

hi! That's curious; are you using any non standard paths for your installed JDKs? I know Gradle does some discovery that might fail to detect your JDK paths.

You might be able to work around this though by following these instructions to not load troublesome modules:

########################################################
# If you are only working on a subset of the modules in this project, you can optimize your
# IDE to only load those modules. Copy `IDE.properties.tmp` to `IDE.properties` and comment out
# any lines that correspond to modules you do not want to work on. This will cause Gradle to
# swap those project dependencies for binary dependencies resolved from either Maven local or
# the OSS snapshots repository, and speed up your IDE.
########################################################

We also have some more general IDE setup instructions on these pages.

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request recipe Requested Recipe
Projects
Status: In Progress
Development

No branches or pull requests

2 participants