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

Trying to add custom java rule #39

Closed
wants to merge 2 commits into from

Conversation

JiriOndrusek
Copy link
Collaborator

This is an experiment with addition of java custom rule among the upgrade process.

Current PR is buildable but when upgrade is executed, I'm getting:

[INFO] [INFO] Using active recipe(s) [io.quarkus.openrewrite.Quarkus]
[INFO] [INFO] Using active styles(s) []
[INFO] [INFO] Validating active recipes...
[INFO] [ERROR] Recipe validation error in custom.recipeList[0] (in file:/tmp/quarkus-project-recipe-10422657056364188551.yaml): recipe 'org.apache.camel.quarkus.poc.SayHelloRecipe' does not exist.
[INFO] [ERROR] Recipe validation error in custom.recipeList[0] (in file:/tmp/quarkus-project-recipe-10422657056364188551.yaml): recipe 'org.apache.camel.quarkus.poc.SayHelloRecipe' does not exist.
[INFO] [ERROR] Recipe validation error in custom.recipeList[0] (in file:/tmp/quarkus-project-recipe-10422657056364188551.yaml): recipe 'org.apache.camel.quarkus.poc.SayHelloRecipe' does not exist.

I expect, that the maven-rewrite plugin which is resolved in runtime has to contain a reference to recipe. Something like this xml definition:

   <plugin>
            <groupId>org.openrewrite.maven</groupId>
            <artifactId>rewrite-maven-plugin</artifactId>
            <version>4.46.0</version>
            <configuration>
                <activeRecipes>
                    <recipe>org.apache.camel.quarkus.update.SayHelloRecipe</recipe>
                </activeRecipes>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.apache.camel.quarkus.update</groupId>
                    <artifactId>recipes</artifactId>
                    <version>1.0-SNAPSHOT</version>
                </dependency>
            </dependencies>
        </plugin>

@JiriOndrusek
Copy link
Collaborator Author

@gsmet May I ask you for help?

@JiriOndrusek
Copy link
Collaborator Author

The standalone project with the recipe alone (used in the xml configuration of the plugin) is here (https://github.com/JiriOndrusek/recipes)

@ia3andy
Copy link
Collaborator

ia3andy commented Jun 12, 2023

@JiriOndrusek What is missing in the existing OpenRewrite recipes that makes you want to write your own in Java?

IMO, if we could stick to the yaml definition and when needed discuss with the OpenRewrite team to have missing features integrated, it will be less to maintain by us (and also less integration work).

@gsmet
Copy link
Member

gsmet commented Jun 12, 2023

That won't fly. Of course, we will favor the YAML ones but we will for sure need custom recipes at some point. I'm working on the infrastructure to support that as we speak.

@gsmet
Copy link
Member

gsmet commented Jun 12, 2023

@JiriOndrusek I pushed some additional changes to your PR but the big missing piece is in the core: quarkusio/quarkus#33983

@JiriOndrusek
Copy link
Collaborator Author

@gsmet thanks for your changes, I'm going to verify it with my local quarkus build and let you know if quarkusio/quarkus#33983 works as expected.

@maxandersen
Copy link
Contributor

IMO, if we could stick to the yaml definition and when needed discuss with the OpenRewrite team to have missing features integrated, it will be less to maintain by us (and also less integration work).

one of the main points of using openrewrite is that we had the ability to provide custom code (which if made sense could be pushed to openrewrite).

@gsmet gsmet closed this Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants