Lombok and Maven

前端 未结 4 1905
一整个雨季
一整个雨季 2020-12-28 16:41

I\'m trying to use Lombok with Maven and VRaptor on IntelliJ but it doesn\'t work.

I already read some info in stackoverflow but none solved my problem, i already en

相关标签:
4条回答
  • 2020-12-28 16:44

    This might work

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.16.12</version>
                        </path>                         
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    Latest versions:

    • https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin
    • https://mvnrepository.com/artifact/org.projectlombok/lombok
    0 讨论(0)
  • 2020-12-28 16:55

    This should work as is, and has nothing to do with IntelliJ idea. But I would:

    • make sure the @Data annotation is the lombok one
    • remove the repository definition (maven central is fine)
    • use a recent lombok version (1.16.0 as of this writing)
    • rebuild (mvn clean package)

    I think the lombok jar is not found by maven in your case or that you might have another @Data.

    0 讨论(0)
  • 2020-12-28 16:57

    You need add lombok plugin:

      <build>
      <plugins>
        <plugin>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok-maven-plugin</artifactId>
          <version>1.16.8.0</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>delombok</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
    
    0 讨论(0)
  • 2020-12-28 17:09

    Try this dependency

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.16</version>
        <scope>provided</scope>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题