7.35.0 Release (2023-01-20)
New Recipes
- org.openrewrite.FindGitProvenance: List out the contents of each unique
GitProvenancemarker in the set of source files. When everything is working correctly, exactly one such marker should be printed as all source files are expected to come from the same repository / branch / commit hash. - org.openrewrite.gradle.AddDependency: Add a gradle dependency to a
build.gradlefile in the correct configuration based on where it is used. - org.openrewrite.gradle.EnableGradleBuildCache: Enable the Gradle build cache. By enabling build cache the build outputs are stored externally and fetched from the cache when it is determined that those inputs have no changed, avoiding the expensive work of regenerating them. See the Gradle Build Cache for more information.
- org.openrewrite.gradle.EnableGradleParallelExecution: Most builds consist of more than one project and some of those projects are usually independent of one another. Yet Gradle will only run one task at a time by default, regardless of the project structure. By using the
--parallelswitch, you can force Gradle to execute tasks in parallel as long as those tasks are in different projects. See the Gradle performance documentation for more information. - org.openrewrite.gradle.plugins.AddBuildPlugin: Add a Gradle build plugin to
build.gradle(.kts). - org.openrewrite.gradle.plugins.AddSettingsPlugin: Add a Gradle settings plugin to
settings.gradle(.kts). - org.openrewrite.gradle.search.DependencyInsight: Find direct and transitive dependencies matching a group, artifact, and optionally a configuration name. Results include dependencies that either directly match or transitively include a matching dependency.
- org.openrewrite.java.cleanup.CommonDeclarationSiteTypeVariances: When using a method parameter like
Function<IN, OUT>, it should rather beFunction<? super IN, ? extends OUT>. This recipe checks for method parameters of well-known types. - org.openrewrite.java.cleanup.DeclarationSiteTypeVariance: Currently, Java requires use-site type variance, so if someone has
Function<IN, OUT>method parameter, it should rather beFunction<? super IN, ? extends OUT>. Unfortunately, it is not easy to notice that? superand? extendsis missing, so this recipe adds it where that would improve the situation. - org.openrewrite.java.cleanup.FinalizePrivateFields: Adds the
finalmodifier keyword to private instance variables which are not reassigned. - org.openrewrite.java.migrate.UpgradeJavaVersion: Upgrade build plugin configuration to use the specified Java version. This recipe changes maven-compiler-plugin target version and related settings. Will not downgrade if the version is newer than the specified version.
- org.openrewrite.java.migrate.hibernate.MigrateToHibernate61: This recipe will apply changes commonly needed when migrating to Hibernate 6.1.x. The hibernate dependencies will be updated to use the new org.hibernate.orm group ID and the recipe will make changes necessary to use Hibernate with Jakarta EE 9.0.
- org.openrewrite.java.migrate.hibernate.MigrateToHibernateDependencies61: This recipe will migrate any existing dependencies on Hibernate 5.x to the latest 6.1.x release. This migration will include the adjustment to the new
org.hibernate.ormgroup ID. It accounts for artifacts names that both do and do not include thejakartasuffix and it will change both dependencies and managed dependencies. - org.openrewrite.java.migrate.jakarta.JavaxAuthenticationMigrationToJakartaAuthentication: Java EE has been rebranded to Jakarta EE, necessitating a package relocation.
- org.openrewrite.java.migrate.jakarta.JavaxAuthorizationMigrationToJakartaAuthorization: Java EE has been rebranded to Jakarta EE, necessitating a package relocation.
- org.openrewrite.java.migrate.jakarta.JavaxPersistenceXmlToJakartaPersistenceXml: Java EE has been rebranded to Jakarta EE, necessitating an XML namespace relocation.
- org.openrewrite.java.recipes.FindRecipes: This recipe finds all OpenRewrite recipes, primarily to produce a data table that is being used to experiment with fine-tuning a large language model to produce more recipes.
- org.openrewrite.java.recipes.SourceSpecTextBlockIndentation: Text blocks that assert before and after source code should have minimal indentation.
- org.openrewrite.java.search.HasJavaVersion: Finds Java source files matching a particular language level. This is useful especially as an applicable test for other recipes.
- org.openrewrite.java.search.HasSourceSet: Source sets are a way to organize your source code into logical groups. For example, Java projects commonly have a
mainsource set for application code and atestsource set for test code. This recipe will find all files in a given source set. - org.openrewrite.java.spring.PropertiesToKebabCase: Normalize Spring properties to use lowercase and hyphen-separated syntax. For example, changing
spring.main.showBannertospring.main.show-banner. With Spring's relaxed binding,kebab-casemay be used in properties files and still be converted to configuration beans. Note, an exception to this is the case of@Value, which is match-sensitive. For example,@Value("${anExampleValue}")will not matchan-example-value. The Spring reference documentation recommends usingkebab-casefor properties where possible.. - org.openrewrite.java.spring.boot2.ChangeEmbeddedServletContainerCustomizer: Find any classes implementing
EmbeddedServletContainerCustomizerand change the interface toWebServerFactoryCustomizer<ConfigurableServletWebServerFactory>. - org.openrewrite.java.spring.boot2.MigrateToWebServerFactoryCustomizer: Use
WebServerFactoryCustomizerinstead of the deprecatedEmbeddedServletContainerCustomizerin Spring Boot 2.0 or higher. This recipe will replace look for any classes that implementEmbeddedServletContainerCustomizerand change the interface toWebServerFactoryCustomizer<ConfigurableServletWebServerFactory>. This recipe also adjusts the types used in thecustomize()method from*EmbeddedServletContainerFactoryto their*ServletWebServerFactorycounterparts. - org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_0: Migrate applications to the latest Spring Boot 2.0 release. This recipe will modify an application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have changes between versions. This recipe will also chain additional framework migrations (Spring Framework, Spring Data, etc) that are required as part of the migration to Spring Boot 2.0.
- org.openrewrite.java.spring.boot3.DowngradeServletApiWhenUsingJetty: Jetty does not yet support Servlet 6.0. This recipe will detect the presence of the
spring-boot-starter-jettyas a first-order dependency and will add the maven propertyjakarta-servlet.versionsetting it's value to5.0.0. This will downgrade thejakarta-servletartifact if the pom's parent extends from the spring-boot-parent. - org.openrewrite.java.spring.boot3.MigrateMaxHttpHeaderSize: Previously, the server.max-http-header-size was treated inconsistently across the four supported embedded web servers. When using Jetty, Netty, or Undertow it would configure the max HTTP request header size. When using Tomcat it would configure the max HTTP request and response header sizes. The renamed property is used to configure the http request header size in Spring Boot 3.0. To limit the max header size of an HTTP response on Tomcat or Jetty (the only two servers that support such a setting), use a
WebServerFactoryCustomizer. - org.openrewrite.java.spring.data.UseTlsJdbcConnectionString: Increasingly, for compliance reasons (e.g. NACHA), JDBC connection strings should be TLS-enabled. This recipe will update the port and optionally add a connection attribute to indicate that the connection is TLS-enabled.
- org.openrewrite.java.testing.assertj.UseExplicitContains: Convert AssertJ
assertThat(collection.contains(element)).isTrue()with assertThat(collection).contains(element) andassertThat(collection.contains(element)).isFalse()with assertThat(collection).doesNotContain(element). - org.openrewrite.maven.NormalizeMavenVariables: Variables are all referenced by the prefix
project.. You may also see references withpom.as the prefix, or the prefix omitted entirely - these forms are now deprecated and should not be used. - org.openrewrite.maven.RemoveRepository: Removes a matching Maven repository.
- org.openrewrite.quarkus.ConfigPropertiesToConfigMapping: Migrate Quarkus configuration classes annotated with
@ConfigPropertiesto the equivalent Smallrye@ConfigMapping. - org.openrewrite.quarkus.ConfigureQuarkusMavenPluginWithReasonableDefaults: Configures the
quarkus-maven-pluginwith reasonable defaults, such as default activatedgoalsand<extensions>configuration. - org.openrewrite.quarkus.MigrateQuarkusMavenPluginNativeImageGoal: Migrates the
quarkus-maven-plugindeprecatednative-imagegoal. If thenative-imagegoal needs to be removed, this adds<quarkus.package.type>native</quarkus.package.type>to thenativeprofilepropertiessection, given thenativeprofile exists in thepom.xml. - org.openrewrite.quarkus.MultiTransformHotStreamToMultiHotStream: Replace Mutiny API usages of
multi.transform().toHotStream()withmulti.toHotStream(). - org.openrewrite.quarkus.Quarkus1to1_13Migration: Migrates Quarkus 1.11 to 1.13.
- org.openrewrite.quarkus.quarkus2.GrpcServiceAnnotationToGrpcClient: The
@GrpcServiceannotation is replaced with@GrpcClientin Quarkus 2.x. Removes the optional@GrpcClient.value()unless the service name is different from the name of annotated element. - org.openrewrite.quarkus.quarkus2.Quarkus1to2Migration: Migrates Quarkus 1.x to 2.x.
- org.openrewrite.quarkus.quarkus2.RemoveAvroMavenPlugin: Removes the
avro-maven-pluginif thequarkus-maven-pluginis found in the project'spom.xml. Avro has been integrated with the Quarkus code generation mechanism. This replaces the need to use the Avro plugin. - org.openrewrite.quarkus.quarkus2.UseIdentifierOnDefaultKafkaBroker: Use
@io.smallrye.common.annotation.Identifieron default kafka broker configuration. - org.openrewrite.quarkus.quarkus2.UsePanacheEntityBaseStaticMethods: The
getEntityManager()and theflush()methods ofPanacheEntityBaseare now static methods. - org.openrewrite.quarkus.quarkus2.UsePanacheEntityBaseUniT: The
persist()andpersistAndFlush()methods now return anUni<T extends PanacheEntityBase>instead of anUni<Void>to allow chaining the methods. - org.openrewrite.quarkus.quarkus2.UseReactivePanacheMongoEntityBaseUniT: The
persist(),update(), andpersistOrUpdate()methods now return aUni<T extends ReactivePanacheMongoEntityBase>instead of aUni<Void>to allow chaining the methods. - org.openrewrite.xml.security.IsOwaspSuppressionsFile: These files are used to suppress false positives in OWASP Dependency Check.
Removed Recipes
- org.openrewrite.gradle.search.EnableGradleParallelExecution: Most builds consist of more than one project and some of those projects are usually independent of one another. Yet Gradle will only run one task at a time by default, regardless of the project structure. By using the
--parallelswitch, you can force Gradle to execute tasks in parallel as long as those tasks are in different projects. See the Gradle performance documentation for more. - org.openrewrite.java.migrate.jakarta.JavaxPeristenceXmlToJakartaPersistenceXml:
- org.openrewrite.java.quarkus.ConfigPropertiesToConfigMapping: Migrate Quarkus configuration classes annotated with
@ConfigPropertiesto the equivalent Smallrye@ConfigMapping. - org.openrewrite.java.quarkus.ConfigureQuarkusMavenPluginWithReasonableDefaults: Configures the
quarkus-maven-pluginwith reasonable defaults, such as default activatedgoalsand<extensions>configuration. - org.openrewrite.java.quarkus.MigrateQuarkusMavenPluginNativeImageGoal: Migrates the
quarkus-maven-plugindeprecatednative-imagegoal. If thenative-imagegoal needs to be removed, this adds<quarkus.package.type>native</quarkus.package.type>to thenativeprofilepropertiessection, given thenativeprofile exists in thepom.xml. - org.openrewrite.java.quarkus.MultiTransformHotStreamToMultiHotStream: Replace Mutiny API usages of
multi.transform().toHotStream()withmulti.toHotStream(). - org.openrewrite.java.quarkus.Quarkus1to1_13Migration: Migrates Quarkus 1.11 to 1.13.
- org.openrewrite.java.quarkus.quarkus2.GrpcServiceAnnotationToGrpcClient: The
@GrpcServiceannotation is replaced with@GrpcClientin Quarkus 2.x. Removes the optional@GrpcClient.value()unless the service name is different from the name of annotated element. - org.openrewrite.java.quarkus.quarkus2.Quarkus1to2Migration: Migrates Quarkus 1.x to 2.x.
- org.openrewrite.java.quarkus.quarkus2.RemoveAvroMavenPlugin: Removes the
avro-maven-pluginif thequarkus-maven-pluginis found in the project'spom.xml. Avro has been integrated with the Quarkus code generation mechanism. This replaces the need to use the Avro plugin. - org.openrewrite.java.quarkus.quarkus2.UseIdentifierOnDefaultKafkaBroker: Use
@io.smallrye.common.annotation.Identifieron default kafka broker configuration. - org.openrewrite.java.quarkus.quarkus2.UsePanacheEntityBaseStaticMethods: The
getEntityManager()and theflush()methods ofPanacheEntityBaseare now static methods. - org.openrewrite.java.quarkus.quarkus2.UsePanacheEntityBaseUniT: The
persist()andpersistAndFlush()methods now return anUni<T extends PanacheEntityBase>instead of anUni<Void>to allow chaining the methods. - org.openrewrite.java.quarkus.quarkus2.UseReactivePanacheMongoEntityBaseUniT: The
persist(),update(), andpersistOrUpdate()methods now return aUni<T extends ReactivePanacheMongoEntityBase>instead of aUni<Void>to allow chaining the methods. - org.openrewrite.java.spring.YamlPropertiesToKebabCase: Normalize Spring YAML properties to use lowercase and hyphen-separated syntax. For example, changing
spring.main.showBannertospring.main.show-banner. With Spring's relaxed binding,kebab-casemay be used in properties files and still be converted to configuration beans. Note, an exception to this is the case of@Value, which is match-sensitive. For example,@Value("${anExampleValue}")will not matchan-example-value. The Spring reference documentation recommends usingkebab-casefor properties where possible. . - org.openrewrite.java.spring.boot2.MigrateSpringBoot_2_0: Migrate applications built on Spring Boot 1.5 to the latest Spring Boot 2.0 release. This recipe will modify an application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have changes between versions. This recipe will also chain additional framework migrations (Spring Framework, Spring Data, etc) that are required as part of the migration to Spring Boot 2.0.
- org.openrewrite.java.spring.boot3.LegacyJmxExposure: Spring Boot 3.0 only exposes the health endpoint via JMX. This change exposes all actuator endpoints via JMX to maintain parity with Spring Boot 2.x. See https://github.com/openrewrite/rewrite-spring/issues/229
Changed Recipes
- org.openrewrite.properties.ChangePropertyKey was changed:
- Old Options:
fileMatcher: { type: String, required: false }newPropertyKey: { type: String, required: true }oldPropertyKey: { type: String, required: true }relaxedBinding: { type: Boolean, required: false }
- New Options:
fileMatcher: { type: String, required: false }newPropertyKey: { type: String, required: true }oldPropertyKey: { type: String, required: true }regex: { type: Boolean, required: false }relaxedBinding: { type: Boolean, required: false }
- Old Options: