Skip to content
Advertisement

Lombok not compiling in maven

I am trying to compile my project that uses lombok through maven and i am getting the following issue:

[INFO] ------------------------------------------------------------------------
[INFO] Building akka-calculator-lib 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ akka-calculator-lib ---
[INFO] Deleting C:devprojectsAkkaakka-testingakka-calculatorakka-calculator-libtarget
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ akka-calculator-lib ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ akka-calculator-lib ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 11 source files to C:devprojectsAkkaakka-testingakka-calculatorakka-calculator-libtargetclasses
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorliboperationmultiplyMultiplyResult.java:[13,22] error: variable firstNumber not initialized in the default constructor
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorliboperationmultiplyMultiplyResult.java:[14,22] error: variable secondNumber not initialized in the default constructor
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorliboperationmultiplyMultiplyResult.java:[15,22] error: variable result not initialized in the default constructor
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[35,52] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[35,87] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[36,54] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[37,74] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[38,74] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[38,101] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[43,50] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[43,85] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[44,64] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[45,84] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[46,84] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[46,111] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[51,50] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[51,85] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[52,64] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[53,84] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[54,84] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[54,111] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[59,50] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[59,85] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[60,60] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[61,80] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[62,89] error: cannot find symbol
[ERROR] devprojectsAkkaakka-testingakka-calculatorakka-calculator-libsrcmainjavacommangusbrotherakkacalculatorlibCalculatorActor.java:[62,127] error: cannot find symbol
[INFO] 27 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] akka-parent ........................................ SUCCESS [  0.164 s]
[INFO] akka-testing ....................................... SUCCESS [  0.011 s]
[INFO] akka-calculator .................................... SUCCESS [  0.010 s]
[INFO] akka-calculator-lib ................................ FAILURE [  2.758 s]
[INFO] akka-calculator-creation ........................... SKIPPED
[INFO] akka-calculator-lookup ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.120 s
[INFO] Finished at: 2016-02-14T19:01:21+01:00
[INFO] Final Memory: 14M/169M
[INFO] ------------------------------------------------------------------------

Where the first error type is for the fields in this class:

package com.mangusbrother.akka.calculator.lib.operation.multiply;


import com.mangusbrother.akka.calculator.lib.operation.MathematicalResult;
import lombok.Data;

/**
 * Created by Mangusbrother on 14/02/2016.
 */
@Data
public class MultiplyResult implements MathematicalResult {
    private static final long serialVersionUID = 738641818941986L;
    private final int firstNumber;
    private final int secondNumber;
    private final int result;
}

and the second error is when a class tries to access getters from lombok classes

My maven pom.xml has the following in it:

<properties>
    <lombok.version>1.16.6</lombok.version>
</properties>
<dependencies>
   <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Advertisement

Answer

I don’t know why but you got compiler error because of maven-compiler-plugin. If you can please change plugin version to 3.5 and check if it will work.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement