-
Notifications
You must be signed in to change notification settings - Fork 332
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
Create a folder #4012
Comments
Hi! The way to do this would be to just create the YAML file from a recipe, and that should result in the folder being created as well; no need to manually create the folder first! :) Let me know if that doesn't work out for you somehow, and we can look into specifics. I'll monitor any replies here, but will close the issue already as I'm assuming there's nothing left to do. |
Hi! I know why: to run my recipes, I don't use a gradle init but I have my own code, like the example in the past on the "running recipes" url (I made an upgrade to OpenRewrite 8). On this part of code Files.writeString(result.getAfter().getSourcePath(),
result.getAfter().printAll()); I have an exception I will search how to solve it. Thanks. |
Ah yes would not immediately have expected that; in that case you'll want to check that any parent to sourcePath exists before you write out the file. Any particular reason you rolled your own solution for running recipes? Curious what case wasn't covered, and if there's something to adopt. |
In my opinion, It is easier to deploy a jar in a context where there is a lots of developers and Java’s applications. I had the possibility to get recipes from a remote server, so it is transparent for developers (they don’t have to download recipes first and they have always the latest version of them). There is also different option to verbose output when recipes don’t work as expected. For cases where it is not a Java application context, we don’t need to install Gradle or have a Gradle wrapper (JRE is installed everywhere for us). And one year ago, when I tried with Gradle, I had some problems so I started to develop my own solution. |
Ah sorry to hear you had issues with Gradle earlier; curious to know if those persist, as we've made a lot of improvements over the past year. Just be aware that we use the Maven and Gradle plugins to set markers common to all source files, some of which are used by recipes. You'd have to replicate that and keep it in sync if you roll your own, but you likely will have encountered that already. |
What do mean by markers ? FencedMarkerPrinter for example or SanitizedMarkerPrinter in grade plugin? You have an example of recipe which use them ? I will test gradle again to know if those persist. |
Ah not I meant the provenance markers we attach to source files. These are for instance used when we upgrade Maven or Gradle wrappers, or when we want to check what Java version is used before running a recipe. |
Ok ! I didn’t have the problem but I will check, thanks ! |
Hi, I tested the Gradle version (with init.gradle) and it is working fine ! I made a pull request to the Gradle plugin : openrewrite/rewrite-gradle-plugin#294 |
Maybe it's not the goal of openrewrite but :
What problem are you trying to solve?
I want to add a yaml file to a folder that doesn't exist.
Describe the situation before applying the recipe
My folder doesn't exist
Describe the situation after applying the recipe
Folder exist
Have you considered any alternatives or workarounds?
Quick and dirty :
The text was updated successfully, but these errors were encountered: