diff --git a/spring-rewrite-commons-docs/pom.xml b/spring-rewrite-commons-docs/pom.xml index b8379897e..a191402a4 100644 --- a/spring-rewrite-commons-docs/pom.xml +++ b/spring-rewrite-commons-docs/pom.xml @@ -89,6 +89,8 @@ github - + ${project.name} + ${project.version} ${project.version} ${project.version} diff --git a/spring-rewrite-commons-docs/src/main/antora/antora.yml b/spring-rewrite-commons-docs/src/main/antora/antora.yml index a638833b5..4c64ba958 100644 --- a/spring-rewrite-commons-docs/src/main/antora/antora.yml +++ b/spring-rewrite-commons-docs/src/main/antora/antora.yml @@ -9,4 +9,4 @@ ext: command: mvnw process-resources local: true scan: - dir: spring-rewrite-commons-docs/target/classes/antora-resources + dir: spring-rewrite-commons-docs/target/classes/antora-resources \ No newline at end of file diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/nav.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/nav.adoc index 69a886fd0..85e97004a 100644 --- a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/nav.adoc +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/nav.adoc @@ -2,5 +2,6 @@ * xref:getting-started.adoc[Getting Started] * xref:concepts.adoc[Concepts] * xref:components.adoc[Components] +* xref:testing.adoc[Testing] * Appendices ** xref:properties.adoc[] diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/components.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/components.adoc index 8195ceae9..4db1d1949 100644 --- a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/components.adoc +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/components.adoc @@ -1 +1,123 @@ -= Components \ No newline at end of file += Components + +The following components can be used to parse a project, run recipes and write changes back to the filesystem. +These components are provided as Spring beans and can be injected into other Spring beans that require them. + +== Injecting Spring Rewrite Commons Components +Spring Rewrite Commons offers components as Spring beans that and can be https://docs.spring.io/spring-framework/reference/core/beans/dependencies/factory-collaborators.html[injected,window=_blank] into existing components. + +[source, java] +.... +@Autowired +private RewriteProjectParser parser; +.... + +== ProjectScanner +Scan a given path to a list of ``https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/Resource.html[Resource,window=_blank]``s using filter definitions provided through xref:properties.adoc[application properties]. + +[source, java] +.... +Path baseDir = ... +List resources = scanner.scan(baseDir); +.... + + + + +== RewriteExecutionContext +OpenRewrite's `ExecutionContext` gets initialized during parsing. +This `ExecutionContext` is required to run recipes and for the inner workings of OpenRewrite. + +== RecipeDiscovery +Discover OpenRewrite recipes on classpath. +These can be custom recipes or recipes provided through https://docs.openrewrite.org/recipes[OpenRewrite's Recipe Catalog] + +=== Access the RecipeDiscovery +The `RecipeDiscovery` component is provided as Spring Bean and can be injected as such, e.g. by using `@Autowired`. + +[source,java] +.... +@Autowired +private RecipeDiscovery discovery; +.... + +=== Discover recipes by name +A single OpenRewrite recipe can be discovered by name. + +[source,java] +.... +Optional recipe = discovery.findRecipeByName("recipe name"); +.... + +=== Discover all recipes +All available OpenRewrite recipes can be discovered. + +[source,java] +.... +List recipes = discovery.findAllRecipes(); +.... + +== ProjectResourceSet +Abstraction of OpenRewrite SourceFiles that allows execution of recipes against the SourceFiles while changes are transparently synchronized with the initial list of SourceFiles. + +=== Creating a ProjectResourceSet +`ProjectResourceSet` is not a Spring bean itself. +The `ProjectResourceSetFactory` is provided as Spring bean and can be injected + +[source, java] +.... +@Autowired +ProjectResourceSetFactory resourceSetFactory; +.... + +and used to create `ProjectResourceSet` instances + +[source, java] +.... +ProjectResourceSet resourceSet = resourceSetFactory.create(baseDir, lst); +.... + +=== Applying recipes + +The `ProjectResourceSet` can be used to sequentially apply OpenRewrite recipes. The results from each recipe run is transparently merged back into the initial LST. + +[source, java] +.... +ProjectResourceSet rs = projectResourceSetFactory.create(baseDir, lst); + +rs.apply(firstRecipe); +rs.apply(secondRecipe); +rs.apply(thirdRecipe); +.... + +== ProjectResourceSetSerializer +`ProjectResourceSetSerializer` helps to synchronize the modified in-memory representation of the scanned project to the filesystem, effectively applying the changes to the codebase (add, update, delete). + +[source, java] +.... +projectResourceSetSerializer.writeChanges(projectResourceSet); +.... + + + + +== Listen to ParserEvents + +``ParserEvent``s get published during parsing. +The events can be used to provide progress information to users. +This is especially useful when parsing large projects where parsing can take some time. + + +* `StartedParsingProjectEvent` - Gets published when the parsing started +* `ParsedResourceEvent` - Gets published after every parsed pom or Java file +* `SuccessfullyParsedProjectEvent` - Gets published when the parsing was successful + +[source,java] +..... +@EventListener(ParsedResourceEvent.class) +public void onParsedResourceEvent(ParsedResourceEvent event) { + Parser.Input input = event.input(); + SourceFile sourceFile = event.sourceFile(); + log("parsed %s to %s".formatted(input.getRelativePath(), sourceFile.getClass().getName())); +} +..... \ No newline at end of file diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/concepts.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/concepts.adoc index ef6a8d7f7..f58431a30 100644 --- a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/concepts.adoc +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/concepts.adoc @@ -1,37 +1,19 @@ [[concepts]] = Spring Rewrite Commons Concepts -* Feature parity with Rewrite Maven Plugin -* How this allows building tools on top of OpenRewrite -* Scoped beans +This sections describes the important concepts of Spring Rewrite Commons and how they relate to concepts from OpenRewrite. +Running OpenRewrite recipes requires a given project to be parsed to create the LST for it. +== Parsing a Project +Spring Rewrite Commons aims to yield the same parsing result (LST) as OpenRewrite's `rewrite-maven-plugin`. +This allows access to the LST from outside the execution of `rewrite-maven-plugin`. +=== RewriteProjectParser +The `RewriteProjectParser` component is a Spring bean and offers the API to parse projects to OpenRewrite LST. -The following components can be used to parse a project, run recipes and write changes back to the filesystem. -These components are provided as Spring beans and can be injected into other Spring beans that require them. +==== Parse a Path +When the application exists on the local filesystem, the path to the project is enough to parse the project to its LST. -_Example: Inject RewriteProjectParser into your Spring bean_ -[source,java] -.... -@Autowired -RewriteProjectParser parser; -.... - -== ProjectScanner -Scan a given path to a list of ``https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/Resource.html[Resource]``s using filter definitions provided through xref:properties.adoc[application properties]. - -[source, java] -.... -Path baseDir = ... -List resources = scanner.scan(baseDir); -.... - -== RewriteProjectParser -Parses a project to OpenRewrite's LST. -The parser aims to produce the exact LST as the OpenRewrite Maven plugins does. -This allows to run recipes outside OpenRewrite's Maven plugin while yielding the same results. - -=== Parse a project [source, java] .... Path baseDir = ... @@ -39,7 +21,10 @@ RewriteProjectParsingResult result = parser.parse(baseDir); List lst = result.sourceFiles(); .... -=== Parse a List of Resources +==== Parse a List of Resources +It is also possible to provide a list of ``https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/Resource.html[Resource]``s and their baseDir. +This allows to provide synthetic resources that only exist in-memory which is helpful to test migration recipes without disk IO. + [source, java] .... Path baseDir = ... @@ -48,76 +33,29 @@ List lst = parser.parse(baseDir, List resources); List lst = result.sourceFiles(); .... -== RewriteExecutionContext -OpenRewrite's `ExecutionContext` gets initialized during parsing. -This `ExecutionContext` is required to run recipes and for the inner workings of OpenRewrite. - -== RecipeDiscovery -Discover OpenRewrite recipes on classpath. -These can be custom recipes or recipes provided through https://docs.openrewrite.org/recipes[OpenRewrite's Recipe Catalog] - -=== Access the RecipeDiscovery -The `RecipeDiscovery` component is provided as Spring Bean and can be injected as such, e.g. by using `@Autowired`. - -[source,java] -.... -@Autowired -private RecipeDiscovery discovery; -.... - -=== Discover recipes by name -A single OpenRewrite recipe can be discovered by name. -[source,java] -.... -Optional recipe = discovery.findRecipeByName("recipe name"); -.... +== Provided Scoped Beans +OpenRewrite initializes some while during parsing a project. +These objects provide information required to execute recipes. +Spring Rewrite Commons provides access to these objects through scoped beans. +The lifetime of these beans starts with the successful parse of a project, and ends with the next parse or when the application is closed. -=== Discover all recipes -All available OpenRewrite recipes can be discovered. - -[source,java] -.... -List recipes = discovery.findAllRecipes(); -.... - -== ProjectResourceSet -Abstraction of OpenRewrite SourceFiles that allows execution of recipes against the SourceFiles while changes are transparently synchronized with the initial list of SourceFiles. - -=== Creating a ProjectResourceSet -`ProjectResourceSet` is not a Spring bean itself. -The `ProjectResourceSetFactory` is provided as Spring bean and can be injected - -[source, java] -.... -@Autowired -ProjectResourceSetFactory resourceSetFactory; -.... - -and used to create `ProjectResourceSet` instances +=== ExecutionContext +OpenRewrite has the concept of an `ExecutionContext`. +The `ExecutionContext` holds information required during recipe execution. +This means the exact same instance needs to be provided to recipe runs. +Spring Rewrite Commons provides the right instance as scoped Spring bean `RewriteExecutionContext`. +This bean can be injected to other Spring Beans in an application and provides access to the `ExecutionContext`. [source, java] .... -ProjectResourceSet resourceSet = resourceSetFactory.create(baseDir, lst); -.... +@Component +public class MyComponent { + @Autowired + private ExecutionContext executionContext; -=== Applying recipes - -The `ProjectResourceSet` can be used to sequentially apply OpenRewrite recipes. The results from each recipe run is transparently merged back into the initial LST. - -[source, java] -.... -ProjectResourceSet rs = projectResourceSetFactory.create(baseDir, lst); - -rs.apply(firstRecipe); -rs.apply(secondRecipe); -rs.apply(thirdRecipe); -.... - -== ProjectResourceSetSerializer -`ProjectResourceSetSerializer` helps to synchronize the modified in-memory representation of the scanned project to the filesystem, effectively applying the changes to the codebase (add, update, delete). - -[source, java] + public void runRecipe() { + Recipe recipe = new SomeOpenRewriteRecipe(); + } +} .... -projectResourceSetSerializer.writeChanges(projectResourceSet); -.... \ No newline at end of file diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc index ce92bb4fb..12b7c49c6 100644 --- a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc @@ -1,154 +1,68 @@ [[getting-started]] = Getting Started -This section offers quick guidance on how to get started with using Spring Rewrite Commons. - - -## Adding the dependency -Currently only SNAPSHOT releases are available from https://repo.spring.io. -To access these, a repository must be added to the project pom.xml. - -[source,xml] -..... - - - spring-snapshot - https://repo.spring.io/snapshot - - false - - - -..... - -Then the dependency can be retrieved. - -[source,xml] -..... - - org.springframwork.experimental - spring-rewrite-commons - 0.1.0-SNAPSHOT - -..... - -== Scan a project (optional) -`ProjectScanner` component scans a given `Path` to a list of ``Resource``s. -It filters out resources and directories matching any of the ignore patterns in `parser.ignoredPathPatterns`. - -== Parse a project -`RewriteProjectParser` is provided as pring bean and parses a project to OpenRewrite LST. - -The provided `parse(Path)` method can be used to parse a project under a given `Path` to OpenRewrite LST. +This section offers quick guidance to developers on how to get started using Spring Rewrite Commons. -[source,java] -..... -@Autowired -RewriteProjectParser parser; - -Path baseDir = ... -List lst = parser.parse(baseDir); -..... -== ExecutionContext -OpenRewrite's `ExecutionContext` is populated during parsing and the settings are required for later recipe execution. -The `ExecutionContext` is provided as scoped Spring bean and can be injected into other Spring beans. -A new instance is created and populated with every parse. +//// +== Create a Simple Spring Boot application +Spring Rewrite Commons is meant to be used in Spring Boot applications. +To create a blank Boot application, go to https://start.spring.io/#!type=maven-project&language=java&platformVersion=3.2.0&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=spring-rewrite-commons-example&name=spring-rewrite-commons-example&description=Demo%20project%20for%20Spring%20Rewrite%20Commons&packageName=com.example.rewrite[start.spring.io,window=_blank] and press "generate" to download a basic Boot application. +//// -NOTE: The ExecutionContext should always be injected and should not be created programmatically. - -[source,java] -.... -@Autowired -ExecutionContext ctx; -.... -== Run a OpenRewrite recipe -The LST and the `ExecutionContext` from the parse is required to apply OpenRewrite recipes. -[source, java] -.... -Recipe rewriteRecipe = ... -RecipeRun recipeRun = rewriteRecipe.run(new InMemoryLargeSourceSet(lst), executionContext) -.... +== Add Repository +include::partials/snapshots-repository.adoc[] +== Add dependency +The dependency to Spring Rewrite Commons must be added to the build file. -== Discover and run recipes +include::partials/dependency-code.adoc[] -OpenRewrite recipes can be discovered from classpath with `RewriteRecipeDiscovery` which is provided as Spring bean. +== Example Application +This dummy code of a Spring application shows how to use the components provided by Spring Rewrite Commons to parse +an application and write back the changes to the filesystem. [source,java] .... -@Autowired -RewriteRecipeDiscovery discovery; - -@Autowired -ExecutionContext ctx; -... -Recipe recipe = discovery.getRecipe("org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1"); -RecipeRun recipe = recipe.run(new InMemoryLargeSourceSet(ast), ctx)); -.... - -== Use ProjectResourceSet -A successful recipe run will return the modified ``SourceFile``s. -Before another recipe can be applied to the AST the changed ``SourceFile``s need to be merged into the original list of ``SourceFile``s (the AST). -The `ProjectResourceSet` provides this capability. +import org.springframework.beans.factory.annotation.Autowired; -[source,java] -.... @Component -public class SomeClass { +public class MyMigrationApplication { - @Autowired - ProjectResourceSetFactory factory; + @Autowired <1> + private RewriteProjectParser parser; @Autowired - RewriteProjectParser parser; - - void method() { - Recipe r1 = ... - Recipe r2 = ... - RewriteProjectParsingResult parsingResult = parser.parse(baseDir); - List sourceFiles = parsingResult.sourceFiles(); - ProjectResourceSet projectResourceSet = factory.create(baseDir, sourceFiles); - projectResourceSet.apply(r1); // internally changes get merged back to AST - projectResourceSet.apply(r2); // r2 applied against the AST with changes from r1 - } -} -.... - -== Write changes back to filesystem -The `ProjectResourceSetSerializer` can be used to write all changes (modify, delete, add) in `ProjectResourceSet` to the filesystem. - -[source,java] -.... -@Autowired -private ProjectResourceSetSerializer serializer; -... -public void method() { - ... - serializer.writeChanges(projectResourceSet); -} -.... + private RewriteRecipeDiscovery discovery; <3> + @Autowired + private ProjectResourceSetFactory resourceSetFactory; <4> - -== Listen to ParserEvents - -``ParserEvent``s get published during parsing. -The events can be used to provide progress information to users. -This is especially useful when parsing large projects where parsing can take some time. + @Autowired + private ProjectResourceSetSerializer serializer; <5> -* `StartedParsingProjectEvent` - Gets published when the parsing started -* `ParsedResourceEvent` - Gets published after every parsed pom or Java file -* `SuccessfullyParsedProjectEvent` - Gets published when the parsing was successful + public void migrateToBoot3_1() { + Path baseDir = ... <2> + String recipeName = "org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1"; + Recipe boot3Upgrade = discover.getByName(recipeName); <3> -[source,java] -..... -@EventListener(ParsedResourceEvent.class) -public void onParsedResourceEvent(ParsedResourceEvent event) { - Parser.Input input = event.input(); - SourceFile sourceFile = event.sourceFile(); - log("parsed %s to %s".formatted(input.getRelativePath(), sourceFile.getClass().getName())); + RewriteParsingResult result = parser.parse(baseDir); <4> + List lst = result.sourceFiles(); <5> + ProjectResourceSet resourceSet = resourceSetFactory.create(baseDir, lst); <6> + resourceSet.apply(boot3Upgrade); <7> + serializer.writeChanges(resourceSet); <8> + } } -..... \ No newline at end of file +.... +<1> All components are Spring beans and can be injected as such. +<2> The path of the project that should be migrated. +<3> `RewriteRecipeDiscovery` is used to discover an OpenRewrite recipe by name. +<4> `RewriteProjectParser` parses a given project to OpenRewrite LST. +<5> The result contains the list of ``SourceFile``s (the LST). +<6> `ProjectResourceSetFactory` can be used to create a `ProjectResourceSet`. +<7> The recipe is applied to the `ProjectResourceSet` which wraps the LST. +<8> `ProjectResourceSetSerializer` is used to serialize the changes to disk. + +Read more about the xref:components.adoc[available components]. diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/index.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/index.adoc index 008a06f73..8763f8cc2 100644 --- a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/index.adoc +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/index.adoc @@ -1,55 +1,39 @@ [[introduction]] -= Spring Rewrite Commons - += Spring Rewrite Commons +Fabian Krüger +:revnumber: {projectVersion} +:revdate: {localdate} +:toc: left +:iconfont-fontawesome: == Overview -The Spring Rewrite Commons project provides a thin abstraction on top of https://github.com/openrewrite/[OpenRewrite]. +Spring Rewrite Commons provides abstractions and parsers for https://github.com/openrewrite/[OpenRewrite]. +The project can parse Java projects using Maven and apply OpenRewrite recipes without the need of a build tool plugin. +It aims to become the foundation for Spring Boot applications using OpenRewrite. -It helps to parse Java projects and apply OpenRewrite recipes without the need of a build tool plugin. -Aiming to provide the foundation for custom Spring Boot applications using OpenRewrite capabilities. +https://github.com/openrewrite/[OpenRewrite] is a code refactoring, remediation, and modernization automation tool providing a rich https://docs.openrewrite.org/recipes[catalog of recipes] for tasks like automated code transformations. -It provides these components +These are the main components offered by Spring Rewrite Commons: -* `xref:concepts.adoc#_rewriteprojectparser[RewriteProjectParser]` - Parse a project to a https://docs.openrewrite.org/concepts-explanations/lossless-semantic-trees[Lossless Semantic Tree] (LST). -* `xref:concepts.adoc#_recipediscovery[RewriteRecipeDiscovery]` - Discover recipes on the classpath -* `xref:concepts.adoc#_projectresourceset[ProjectResourceSet]` - Run https://github.com/openrewrite/[OpenRewrite] recipes sequentially. -* `xref:concepts.adoc#_projectresourcesetserializer[ProjectResourceSetSerializer]` Synchronize the filesystem with recipe results +* `xref:concepts.adoc#_rewriteprojectparser[RewriteProjectParser]` - Parse a project to an OpenRewrite https://docs.openrewrite.org/concepts-explanations/lossless-semantic-trees[Lossless Semantic Tree] (LST). +* `xref:concepts.adoc#_recipediscovery[RewriteRecipeDiscovery]` - Discover recipes on the classpath. +* `xref:concepts.adoc#_projectresourceset[ProjectResourceSet]` - Encapsulates the LST to run https://github.com/openrewrite/[OpenRewrite] recipes sequentially. +* `xref:concepts.adoc#_projectresourcesetserializer[ProjectResourceSetSerializer]` - Serialize the current state of the `ProjectResourceSet` to the filesystem. +* Some helpers for xref:testing.adoc[testíng] also exist -And some helpers for xref:testing.adoc[writing tests]. == Using Spring Rewrite Commons -Currently only SNAPSHOT releases are available from https://repo.spring.io. -To access these, a repository must be added to the project pom.xml. - -[source,xml] -..... - - - spring-snapshot - https://repo.spring.io/snapshot - - false - - - -..... + +include::partials/snapshots-repository.adoc[] Then the dependency can be retrieved. -Which makes the components available as Spring beans. -[source,xml] -..... - - org.springframwork.experimental - spring-rewrite-commons - 0.1.0-SNAPSHOT - -..... +include::partials/dependency-code.adoc[] == Examples -Some working examples exist to demo things you can build using this project. +Some working examples exist to demo what can be built using Spring Rewrite Commons. * file://spring-rewrite-commons-examples/boot-3-upgrade-atomic[Atomically upgrade a Spring Boot application] * file://spring-rewrite-commons-examples/boot-3-upgrade-iterative[Iteratively upgrade a Spring Boot application using PRs] @@ -58,10 +42,18 @@ Some working examples exist to demo things you can build using this project. All examples can be found file://spring-rewrite-commons-examples[here]. == Limitations -The project has currently some limitations which we're working on. +The project has currently some limitations. -. *Only Maven supported.* + +. No Gradle support. + OpenRewrite provides a build tool plugin for Gradle projects. This project currently only parses Maven projects. -. *Only Java supported.* + +. No Kotlin support. + OpenRewrite can parse other languages than Java, especially Kotlin. This is not yet supported. +. Supports only Java 17 + +OpenRewrite uses JDK internals and provides dedicated parsers. Currently only Java 17 parser is supported. +. Inherited version will just be read from direct parent. Meaning a version from a parent with distance > 1 will be empty (`null`) +. Maven profiles are currently ignored and 'default' profile is used +. Styles are not supported + +OpenRewrite styles are currently not supported. +. Migrating projects for Maven plugins might fail + +Maven plugin projects (modules) are currently ignored when building the reactor order. \ No newline at end of file diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/partials/dependency-code.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/partials/dependency-code.adoc new file mode 100644 index 000000000..baa9ae344 --- /dev/null +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/partials/dependency-code.adoc @@ -0,0 +1,20 @@ +[tabs] +====== +Maven:: ++ +[source,xml,indent=0,subs="verbatim,quotes,attributes",role="primary"] +---- + + org.springframwork.rewrite + spring-rewrite-commons + {projectVersion} + +---- + +Gradle:: ++ +[source,groovy,indent=0,subs="verbatim,quotes,attributes",role="secondary"s] +---- +compile 'org.springframework.rewrite:spring-rewrite-commons:{projectVersion}' +---- +====== \ No newline at end of file diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/partials/snapshots-repository.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/partials/snapshots-repository.adoc new file mode 100644 index 000000000..569f37506 --- /dev/null +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/partials/snapshots-repository.adoc @@ -0,0 +1,30 @@ +Currently only SNAPSHOT releases are available from the https://repo.spring.io[Spring Repository,window=_blank]. +The repository information must be added to the project build file. + +[tabs] +====== +Maven:: ++ +[source,xml,indent=0,subs="verbatim,quotes",role="primary"] +..... + + + spring-snapshot + https://repo.spring.io/snapshot + + false + + + +..... + +Gradle:: ++ +[source,groovy,indent=0,subs="verbatim,quotes",role="secondary"] +---- +repositories { + mavenCentral() + maven { url "http://repo.spring.io/libs-snapshot" } +} +---- +====== \ No newline at end of file diff --git a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/properties.adoc b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/properties.adoc index e17e284d9..9609720ac 100644 --- a/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/properties.adoc +++ b/spring-rewrite-commons-docs/src/main/antora/modules/ROOT/pages/properties.adoc @@ -7,7 +7,7 @@ | `parser.pomCacheEnabled` | `false` -| Set to 'true' to use a composite cache of `RocksdbMavenPomCache` and `InMemoryMavenPomCache`. Otherwise, use OpenRewrite's `InMemoryMavenPomCache`. +| Set to `true` to use a composite cache of `RocksdbMavenPomCache` and `InMemoryMavenPomCache`. Otherwise, use OpenRewrite's `InMemoryMavenPomCache`. | `parser.pomCacheDirectory` | `~/.rewrite-cache` diff --git a/spring-rewrite-commons-docs/src/main/antora/resources/antora-resources/antora.yml b/spring-rewrite-commons-docs/src/main/antora/resources/antora-resources/antora.yml index b2b3baf62..aae94d4e2 100644 --- a/spring-rewrite-commons-docs/src/main/antora/resources/antora-resources/antora.yml +++ b/spring-rewrite-commons-docs/src/main/antora/resources/antora-resources/antora.yml @@ -1,2 +1,7 @@ version: ${antora-component.version} prerelease: ${antora-component.prerelease} +asciidoc: + attributes: + attribute-missing: 'warn' + version: ${project.version} + projectversion: ${project.version} diff --git a/spring-rewrite-commons-examples/boot-3-upgrade-iterative/pom.xml b/spring-rewrite-commons-examples/boot-3-upgrade-iterative/pom.xml index 06ddcfa77..1c29268c4 100644 --- a/spring-rewrite-commons-examples/boot-3-upgrade-iterative/pom.xml +++ b/spring-rewrite-commons-examples/boot-3-upgrade-iterative/pom.xml @@ -64,6 +64,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot.version} com.example.bootupgrade.IterativeBoot3UpgradeExample