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 reference to -parameters somewhere #185

Open
nmck257 opened this issue Jun 23, 2023 · 3 comments
Open

Add reference to -parameters somewhere #185

nmck257 opened this issue Jun 23, 2023 · 3 comments
Labels
blocked When an issue can't be worked on right now documentation Improvements or additions to documentation enhancement New feature or request

Comments

@nmck257
Copy link

nmck257 commented Jun 23, 2023

I was working with someone recently who was getting started with recipe development, using a Maven project.

When trying to run their SayHello recipe, they ran into the cryptic recipe-deserialization issue which the -parameters option solves (eg https://github.com/moderneinc/rewrite-recipe-starter/blob/main/build.gradle.kts#L82)

Sample error message:

Recipe validation error in com.mycompany.MyRecipe: Unable to load Recipe: java.lang.IllegalArgumentException: Invalid type definition for type com.mycompany.MyRecipe: Argument #0 of constructor [constructor for com.mycompany.MyRecipe (7 args), annotations: {interface com.fasterxml.jackson.annotation.JsonCreator=@com.fasterxml.jackson.annotation.JsonCreator(mode=DEFAULT)} has no property name (and is not Injectable): can not use as property-based Creator
at [Source: UNKNOWN; byte offset: #UNKNOWN]`

The option is already included in the Gradle rewrite-recipe-starter, but if a beginner deviates at all and runs into that error, then it's pretty difficult to troubleshoot. I think it's worth writing down somewhere.

@nmck257 nmck257 added the enhancement New feature or request label Jun 23, 2023
@knutwannheden
Copy link
Contributor

Good call. Possibly the RecipeTest infrastructure could provide this hint.

@joanvr joanvr moved this to Backlog in OpenRewrite Jun 26, 2023
@timtebeek timtebeek added the documentation Improvements or additions to documentation label Jul 18, 2023
@mike-solomon
Copy link
Contributor

@knutwannheden Do you think this should be moved to rewrite instead? I may be misunderstanding, but your comment makes it sound like this is something we should change in rewrite itself rather than in the docs.

If this is something we want to add to the docs, does anyone have thoughts on where to add this? Also, could anyone provide me with more context on this if that's the case? Is the issue that people see an error message that contains something like no property name and then they need to update their build.gradle file to include a parameters flag or something? How does that help and what is that doing?

Thanks!

@mike-solomon mike-solomon added the blocked When an issue can't be worked on right now label Aug 1, 2023
@pukkaone
Copy link

pukkaone commented Jul 7, 2024

Developers who follow the documentation's suggested path of using the rewrite-recipe-starter repository as a template for their recipe project are fortunate to start with a Maven project that turns on the -parameters option of the Java compiler . This option is necessary for OpenRewrite to deserialize recipes.

However, developers who follow the documentation's manual project setup path will encounter this deserialization error. The example Maven build file does NOT turn on the -parameters option. The documentation does not mention that this option must be turned on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked When an issue can't be worked on right now documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

5 participants