gradle build failing - possible lombok issue











up vote
1
down vote

favorite












I've installed lombok 1.18.4 for STS.



However, if I try to build my jar in the terminal with ./gradlew clean build rather than through STS I get this error:



Task :compileJava FAILED
Image.java:12: error: constructor Image() is already defined in class Image
@NoArgsConstructor
^
1 error


I found this page which suggests it's an issue with an older version of lombok. As I seem to have it installed and working through the IDE, is there anything I must do to get this to build in the terminal?



Here is my Image class code:



package com.greglturnquist.learningspringboot.learningspringboot;

import lombok.Data;
import lombok.NoArgsConstructor;

//tag::code
@Data
@NoArgsConstructor
public class Image {

private int id;
private String name;

public Image(int id, String name) {
this.id = id;
this.name = name;
}

}
//end::code









share|improve this question




















  • 1




    can you update Image class code?
    – Deadpool
    yesterday










  • probably you have already defined a default no arg Image constructor, so you should remove it if you're using @NoArgsConstructor
    – Abdelghani Roussi
    yesterday










  • Apologies. Code updated.
    – runnerpaul
    yesterday






  • 1




    What version of Lombok is defined in your Gradle dependencies? That's the version of the annotation processor that would be used for a command line build, as far as I know.
    – Michael Murray
    yesterday












  • Actually, it seems to be 1.16.22 which I believe is the problem version. How do I update dependency versions in Gradle?
    – runnerpaul
    yesterday















up vote
1
down vote

favorite












I've installed lombok 1.18.4 for STS.



However, if I try to build my jar in the terminal with ./gradlew clean build rather than through STS I get this error:



Task :compileJava FAILED
Image.java:12: error: constructor Image() is already defined in class Image
@NoArgsConstructor
^
1 error


I found this page which suggests it's an issue with an older version of lombok. As I seem to have it installed and working through the IDE, is there anything I must do to get this to build in the terminal?



Here is my Image class code:



package com.greglturnquist.learningspringboot.learningspringboot;

import lombok.Data;
import lombok.NoArgsConstructor;

//tag::code
@Data
@NoArgsConstructor
public class Image {

private int id;
private String name;

public Image(int id, String name) {
this.id = id;
this.name = name;
}

}
//end::code









share|improve this question




















  • 1




    can you update Image class code?
    – Deadpool
    yesterday










  • probably you have already defined a default no arg Image constructor, so you should remove it if you're using @NoArgsConstructor
    – Abdelghani Roussi
    yesterday










  • Apologies. Code updated.
    – runnerpaul
    yesterday






  • 1




    What version of Lombok is defined in your Gradle dependencies? That's the version of the annotation processor that would be used for a command line build, as far as I know.
    – Michael Murray
    yesterday












  • Actually, it seems to be 1.16.22 which I believe is the problem version. How do I update dependency versions in Gradle?
    – runnerpaul
    yesterday













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I've installed lombok 1.18.4 for STS.



However, if I try to build my jar in the terminal with ./gradlew clean build rather than through STS I get this error:



Task :compileJava FAILED
Image.java:12: error: constructor Image() is already defined in class Image
@NoArgsConstructor
^
1 error


I found this page which suggests it's an issue with an older version of lombok. As I seem to have it installed and working through the IDE, is there anything I must do to get this to build in the terminal?



Here is my Image class code:



package com.greglturnquist.learningspringboot.learningspringboot;

import lombok.Data;
import lombok.NoArgsConstructor;

//tag::code
@Data
@NoArgsConstructor
public class Image {

private int id;
private String name;

public Image(int id, String name) {
this.id = id;
this.name = name;
}

}
//end::code









share|improve this question















I've installed lombok 1.18.4 for STS.



However, if I try to build my jar in the terminal with ./gradlew clean build rather than through STS I get this error:



Task :compileJava FAILED
Image.java:12: error: constructor Image() is already defined in class Image
@NoArgsConstructor
^
1 error


I found this page which suggests it's an issue with an older version of lombok. As I seem to have it installed and working through the IDE, is there anything I must do to get this to build in the terminal?



Here is my Image class code:



package com.greglturnquist.learningspringboot.learningspringboot;

import lombok.Data;
import lombok.NoArgsConstructor;

//tag::code
@Data
@NoArgsConstructor
public class Image {

private int id;
private String name;

public Image(int id, String name) {
this.id = id;
this.name = name;
}

}
//end::code






java spring spring-boot lombok






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday

























asked yesterday









runnerpaul

533322




533322








  • 1




    can you update Image class code?
    – Deadpool
    yesterday










  • probably you have already defined a default no arg Image constructor, so you should remove it if you're using @NoArgsConstructor
    – Abdelghani Roussi
    yesterday










  • Apologies. Code updated.
    – runnerpaul
    yesterday






  • 1




    What version of Lombok is defined in your Gradle dependencies? That's the version of the annotation processor that would be used for a command line build, as far as I know.
    – Michael Murray
    yesterday












  • Actually, it seems to be 1.16.22 which I believe is the problem version. How do I update dependency versions in Gradle?
    – runnerpaul
    yesterday














  • 1




    can you update Image class code?
    – Deadpool
    yesterday










  • probably you have already defined a default no arg Image constructor, so you should remove it if you're using @NoArgsConstructor
    – Abdelghani Roussi
    yesterday










  • Apologies. Code updated.
    – runnerpaul
    yesterday






  • 1




    What version of Lombok is defined in your Gradle dependencies? That's the version of the annotation processor that would be used for a command line build, as far as I know.
    – Michael Murray
    yesterday












  • Actually, it seems to be 1.16.22 which I believe is the problem version. How do I update dependency versions in Gradle?
    – runnerpaul
    yesterday








1




1




can you update Image class code?
– Deadpool
yesterday




can you update Image class code?
– Deadpool
yesterday












probably you have already defined a default no arg Image constructor, so you should remove it if you're using @NoArgsConstructor
– Abdelghani Roussi
yesterday




probably you have already defined a default no arg Image constructor, so you should remove it if you're using @NoArgsConstructor
– Abdelghani Roussi
yesterday












Apologies. Code updated.
– runnerpaul
yesterday




Apologies. Code updated.
– runnerpaul
yesterday




1




1




What version of Lombok is defined in your Gradle dependencies? That's the version of the annotation processor that would be used for a command line build, as far as I know.
– Michael Murray
yesterday






What version of Lombok is defined in your Gradle dependencies? That's the version of the annotation processor that would be used for a command line build, as far as I know.
– Michael Murray
yesterday














Actually, it seems to be 1.16.22 which I believe is the problem version. How do I update dependency versions in Gradle?
– runnerpaul
yesterday




Actually, it seems to be 1.16.22 which I believe is the problem version. How do I update dependency versions in Gradle?
– runnerpaul
yesterday












2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Based on your comment about the Gradle version, look for the build.gradle file for your project.



Find the dependencies section within, and update the line related to lombok to match your STS version



You should see a line similar to this, but with 1.16.22 as the version.



dependencies {
compileOnly('org.projectlombok:lombok:1.18.4')
}





share|improve this answer























  • Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
    – runnerpaul
    yesterday










  • Feel free to suggest an edit to the answer so it's more correct.
    – Michael Murray
    yesterday


















up vote
1
down vote













Try with the AccessLevel i'm just going through this issue in github here



@NoArgsConstructor(access=AccessLevel.PUBLIC)


Github Resource From the refered link




Yes, this is a bug. Sorry. Will see how soon we can make a new release.



1.16.22 constructor has private access #1704




OR update to




Update Lombok dependency version to 1.18.2 #14127







share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401078%2fgradle-build-failing-possible-lombok-issue%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    Based on your comment about the Gradle version, look for the build.gradle file for your project.



    Find the dependencies section within, and update the line related to lombok to match your STS version



    You should see a line similar to this, but with 1.16.22 as the version.



    dependencies {
    compileOnly('org.projectlombok:lombok:1.18.4')
    }





    share|improve this answer























    • Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
      – runnerpaul
      yesterday










    • Feel free to suggest an edit to the answer so it's more correct.
      – Michael Murray
      yesterday















    up vote
    2
    down vote



    accepted










    Based on your comment about the Gradle version, look for the build.gradle file for your project.



    Find the dependencies section within, and update the line related to lombok to match your STS version



    You should see a line similar to this, but with 1.16.22 as the version.



    dependencies {
    compileOnly('org.projectlombok:lombok:1.18.4')
    }





    share|improve this answer























    • Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
      – runnerpaul
      yesterday










    • Feel free to suggest an edit to the answer so it's more correct.
      – Michael Murray
      yesterday













    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    Based on your comment about the Gradle version, look for the build.gradle file for your project.



    Find the dependencies section within, and update the line related to lombok to match your STS version



    You should see a line similar to this, but with 1.16.22 as the version.



    dependencies {
    compileOnly('org.projectlombok:lombok:1.18.4')
    }





    share|improve this answer














    Based on your comment about the Gradle version, look for the build.gradle file for your project.



    Find the dependencies section within, and update the line related to lombok to match your STS version



    You should see a line similar to this, but with 1.16.22 as the version.



    dependencies {
    compileOnly('org.projectlombok:lombok:1.18.4')
    }






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday









    runnerpaul

    533322




    533322










    answered yesterday









    Michael Murray

    447815




    447815












    • Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
      – runnerpaul
      yesterday










    • Feel free to suggest an edit to the answer so it's more correct.
      – Michael Murray
      yesterday


















    • Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
      – runnerpaul
      yesterday










    • Feel free to suggest an edit to the answer so it's more correct.
      – Michael Murray
      yesterday
















    Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
    – runnerpaul
    yesterday




    Thanks. I had to edit the code sample you provided but your suggestion worked a treat.
    – runnerpaul
    yesterday












    Feel free to suggest an edit to the answer so it's more correct.
    – Michael Murray
    yesterday




    Feel free to suggest an edit to the answer so it's more correct.
    – Michael Murray
    yesterday












    up vote
    1
    down vote













    Try with the AccessLevel i'm just going through this issue in github here



    @NoArgsConstructor(access=AccessLevel.PUBLIC)


    Github Resource From the refered link




    Yes, this is a bug. Sorry. Will see how soon we can make a new release.



    1.16.22 constructor has private access #1704




    OR update to




    Update Lombok dependency version to 1.18.2 #14127







    share|improve this answer



























      up vote
      1
      down vote













      Try with the AccessLevel i'm just going through this issue in github here



      @NoArgsConstructor(access=AccessLevel.PUBLIC)


      Github Resource From the refered link




      Yes, this is a bug. Sorry. Will see how soon we can make a new release.



      1.16.22 constructor has private access #1704




      OR update to




      Update Lombok dependency version to 1.18.2 #14127







      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        Try with the AccessLevel i'm just going through this issue in github here



        @NoArgsConstructor(access=AccessLevel.PUBLIC)


        Github Resource From the refered link




        Yes, this is a bug. Sorry. Will see how soon we can make a new release.



        1.16.22 constructor has private access #1704




        OR update to




        Update Lombok dependency version to 1.18.2 #14127







        share|improve this answer














        Try with the AccessLevel i'm just going through this issue in github here



        @NoArgsConstructor(access=AccessLevel.PUBLIC)


        Github Resource From the refered link




        Yes, this is a bug. Sorry. Will see how soon we can make a new release.



        1.16.22 constructor has private access #1704




        OR update to




        Update Lombok dependency version to 1.18.2 #14127








        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered yesterday









        Deadpool

        3,0362324




        3,0362324






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401078%2fgradle-build-failing-possible-lombok-issue%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Berounka

            Sphinx de Gizeh

            Different font size/position of beamer's navigation symbols template's content depending on regular/plain...