Lombok annotation processor not added to modules of a Maven multi-module project
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 50/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- java
- 領域
- build-system, tooling
調査の方向性
EnableLombokAnnotationProcessor recipe と doesNotAddLombokToModuleWithoutLombok という名前のテストから始め、次にマルチモジュールのルートと with-lombok 内で直接 rewrite:run を再現します。この動作を #1031 で追加されたテストと比較します。root と without-lombok の POM が変更されず、with-lombok に annotation processor が追加されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What version of OpenRewrite are you using?
- OpenRewrite v8.83.0
- Maven plugin v6.40.0
- rewrite-migrate-java v3.35.0
How are you running OpenRewrite?
via Maven on a multi-module project
What is the smallest, simplest way to reproduce the problem?
This is a multi-module project with a root and two modules. One of the modules uses lombok.
I set the version of rewrite-migrate-java to 3.31.2 because the behaviour changed from 3.31.1 to 3.31.2 and is the same from 3.31.2 to 3.35.0.
pom.xml of root module:
<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.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>with-lombok</module>
<module>without-lombok</module>
</modules>
<properties>
<maven.compiler.release>21</maven.compiler.release>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.44</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.40.0</version>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.EnableLombokAnnotationProcessor</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>3.31.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
pom.xml of module with-lombok:
<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>
<parent>
<groupId>org.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>with-lombok</artifactId>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
pom.xml of module without-lombok:
<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>
<parent>
<groupId>org.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>without-lombok</artifactId>
</project>
What did you expect to see?
Up to rewrite-migrate-java version 3.31.1, the Lombok annotation processor was added to the parent pom. My understanding is that the intention of #1031 (added in version 3.31.2) was to add the annotation processor only to those modules where lombok is used.
Therefore, I expect
- the pom.xml of the root module to be unchanged,
- the pom.xml of module without-lombok to be unchanged and
- the annotation processor being added to the pom.xml of module with-lombok:
<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>
<parent>
<groupId>org.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>with-lombok</artifactId>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.44</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
What did you see instead?
The Lombok annotation processor is added to none of the pom.xml files.
Additional considerations
- The Lombok annotation processor will be added, when I run rewrite:run directly on the module with-lombok. But I doubt that it is the intended behaviour to run the target on each module individually.
- The tests added with #1031 do not truly use a multi-module project. The new test
doesNotAddLombokToModuleWithoutLombokjust uses a set of two (unrelated) modules. - Is traversing the module hierarchy the missing part?
- 主要言語
- Java
- スター
- 156
- フォーク
- 129
- 平均マージ
- 3日 8時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openrewrite/rewrite-migrate-java のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
openrewrite/rewrite-migrate-java#1246 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
openrewrite/rewrite-migrate-java#1228 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
openrewrite/rewrite-migrate-java#1227 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
openrewrite/rewrite-migrate-java#1146 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
openrewrite/rewrite-migrate-java#1069 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
openrewrite/rewrite-migrate-java の issue をすべて見る
似ている issue
-
area/frontend good first issue kind/cooldown
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
beehive-lab/TornadoVM#1151 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
FasterXML/jackson-dataformats-binary#823 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信