我正在使用Selma来映射带有Lombok的注释的pojo。不幸的是,它似乎开箱即用:

  • https://github.com/murat8505/projectlombok/issues/812
  • https://groups.google.com/d/msg/selma-java/m44hHSB-Dco/c75mVcypAgAJ

  • 有没有人能够重新配置注释处理器以在同一Maven模块中使用这两种工具?

    我的样本在这里:https://github.com/pomverte/selma-test

    最佳答案

    我能够使用以下命令生成Lombok + Selma类:

    在您的pom.xml中:

    <plugins>
       <build>
          <plugin>
                <groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <defaultOutputDirectory>
                        ${project.build.directory}/generated-sources/selma
                    </defaultOutputDirectory>
                    <processors>
                        <processor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</processor>
                        <processor>fr.xebia.extras.selma.codegen.MapperProcessor</processor>
                    </processors>
                </configuration>
                <executions>
                    <execution>
                        <id>process</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>process</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>fr.xebia.extras</groupId>
                        <artifactId>selma-processor</artifactId>
                        <version>0.15</version>
                    </dependency>
                </dependencies>
      </plugin>
     </plugins>
    </build>
    

    然后运行:mvn generate-sources

    07-24 09:22