Support Spring Boot apps with no explicit version config
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- java, kotlin, spring-boot
- 领域
- build-system
调研方向
从 issue 中的 Kotlin rewriteRun 测试开始,检查现有的、用于更新 java.version 属性的 recipes。确定应如何将 Spring Boot parent 默认值与其他 Java 版本配置一并处理,然后为所选行为添加覆盖。提供的测试通过且不破坏现有迁移用例,即表示完成。
由索引模型根据 Issue 内容生成。
描述
test case:
@Test
fun `adds java version property if not present if spring-like parent`() = rewriteRun(
pomXml("""
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
</parent>
</project>
""".trimIndent(),
"""
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
</parent>
<properties>
<java.version>11</java.version>
</properties>
</project>
""".trimIndent()
) // fails with no change
)
Spring Boot declares a java.version property, pre-wired into the maven-compiler-plugin config. This is a convenient, common pattern to manage a project's Java version, and our recipes support updating that property if present.
But, because Spring Boot provides a default value (1.8) for java.version, it's feasible for a Spring Boot app to have no explicit configuration for its Java version in its pom.xml. And in that case, the upgrade recipe will do everything but actually update the build's Java version. The test case above shows this.
The tricky part here is deciding how generic the solution should be -- eg:
- do we just check for the "hardcoded" spring-boot-starter-parent parent, or identify arbitrary (non-project) parents which declare
java.version - should we validate that project pom isn't already managing its java version a different way (ie no explicit maven-compiler-plugin config)
- should we enforce an opinion that projects with spring-like parents should only use the
java.versionproperty to manage the Java version
- 主要语言
- Java
- 星标
- 156
- 派生
- 129
- 平均合并
- 14 小时 30 分钟
- 30 天内合并 PR
- 43
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openrewrite/rewrite-migrate-java 的其他 Issue
-
bug
难度 4/5 3-5 天 新手友好度 68/100
openrewrite/rewrite-migrate-java#1246 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 32/100
openrewrite/rewrite-migrate-java#1227 · 2 条评论 ·
维护者通常 1 天内回复
-
OptionalNotPresentToIsEmpty rewrites `!isPresent()` on a non-`java.util.Optional` type, producing uncompilable `isEmpty()`可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 3/5 1-2 天 新手友好度 70/100
openrewrite/rewrite-migrate-java#1146 · 3 条评论 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 50/100
openrewrite/rewrite-migrate-java#1119 · 5 条评论 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 45/100
openrewrite/rewrite-migrate-java#1069 · 2 条评论 ·
维护者通常 1 天内回复
查看 openrewrite/rewrite-migrate-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
apache/rocketmq-dashboard#6331 ·
维护者通常 5 天内回复
-
status: team-only type: dependency-upgrade
难度 2/5 1-3 小时 新手友好度 68/100
spring-projects/spring-boot#52143 · 1 条评论 ·
维护者通常 1 天内回复
-
area/frontend good first issue kind/cooldown
难度 2/5 1-3 小时 新手友好度 78/100
kestra-io/kestra#20704 · 1 条评论 ·
维护者通常 1 天内回复