0

We have a rather large project, using maven, spring boot, querydsl, lombok. I had 2 branches, both versions compiling successfully. (mvn clean compile) However, after merging, build fails, every of these compiler errors looks like lombok did not run correctly - errors are like cannot find symbol [ERROR] symbol: variable log with log generated by @Sl4j or cannot find getXyz() on a class instance with @Getter.

I don't even know where to start here, so any hint on how to pin down that error would be great. And, of course, what further information do you need to help?

EDIT Thanks for the hints so far, I now tried to adapt our pom.xml configuration so that lombok is triggered by maven-compiler-plugin's annotationProcessorPaths - My new pom.xml / plugin config is:

<build>

    <pluginManagement>
        <plugins>
            <!-- maven dependancy update management plugins-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.0.5</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <excludes>
                        <exclude>org.apache.commons:commons-collections4</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!--querydsl configuration-->
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources/querydsl</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <compilerArgs>
                        <arg>-Aquerydsl.entityAccessors=true</arg>
                        <arg>-Aquerydsl.useFields=false</arg>
                    </compilerArgs>
                    <annotationProcessorPaths>

                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.18.8</version>
                        </path>

                        <path>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-core</artifactId>
                            <version>${querydsl.version}</version>ø
                        </path>
                        <path>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-apt</artifactId>
                            <version>${querydsl.version}</version>
                        </path>
                        <path>
                            <groupId>com.mysema.codegen</groupId>
                            <artifactId>codegen</artifactId>
                            <version>0.6.8</version>
                        </path>

                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
            </plugin>


        </plugins>
    </pluginManagement>
</build>

This config compiles the version before the problem occurred; However, the build error with the post-merge version remains the same. Is my lombok config incorrect?

tosh007
  • 111
  • 1
  • 5
  • Do you have annotation processor enabled? are you using mapstruct? what IDE are you using? does it have lombok plugin? – Syed Siraj Uddin Aug 19 '19 at 16:56
  • 1
    try by including Lombok in anootationProcessorPaths. This has been discussed here - https://stackoverflow.com/questions/47676369/mapstruct-and-lombok-not-working-together – Nuthan Kumar Aug 19 '19 at 17:50

1 Answers1

1

Actually, our pom.xml setup was perfectly fine. However, during merge, git duplicated an hibernate @EntityListener annotation. As a result, lombok somehow... stopped working? When I removed one of the annotations, everything was fine again.

Would there have been a way to detect this Problem, like lombok logs?

tosh007
  • 111
  • 1
  • 5