Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Lombok annotation processor not added to modules of a Maven multi-module project

Đang mở
#1,119 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
50/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Bắt đầu với recipe EnableLombokAnnotationProcessor và test có tên doesNotAddLombokToModuleWithoutLombok, sau đó tái hiện rewrite:run tại root của multi-module và trực tiếp trong with-lombok. So sánh hành vi này với các test được thêm trong #1031. Hoàn tất khi các POM của root và without-lombok vẫn không thay đổi, trong khi annotation processor được thêm vào with-lombok.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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 doesNotAddLombokToModuleWithoutLombok just uses a set of two (unrelated) modules.
  • Is traversing the module hierarchy the missing part?
Ngôn ngữ chính
Java
Star
156
Fork
130
Merge trung bình
3 ngày 8 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openrewrite/rewrite-migrate-java

Tất cả issue của openrewrite/rewrite-migrate-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.