This week's book giveaways are in the Jython/Python and Object-Oriented programming forums. We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line! See this thread and this one for details.
I stumbled on a small problem. Namely, on Chapter 2, we are supposed to create a domain class called Ingredient (for ordering tacos..). The author explained reasons why we should use lombok for this class. I followed author's instructions on how to install lombok, but STS is still reporting errors. I went on lombok's web site to follow up how to install .jar for STS and I tried MANY tips from SO, but nothing worked. Bellow are my steps (and current setup on my comp) I used for trying to set up lombok.
Assuming I need to specify location for SpringToolSuite4, I do so by selecting installation folder where STS is located. This is how it looks like. This is final look on wizard before hitting Install/Update button.
If I go back again to folder where STS is installed (unzipped), this is how it looks like. Jar lombok is present. New content of .ini file, now, I have that line you mentioned in your post. I am not sure if that is correct.
Once start STS again, it complains that it doesn't see lombok.
From what I understand in your screenshots, Eclipse/STS is setup properly. But, your specific project does not contain the jar yet. I think your pom.xml is not valid. The dependency does not look right to me.
If you're using lombok 1.18.10, your pom.xml should look like this:
Mike Gosling wrote:The author explained reasons why we should use lombok for this class
Would you mind to share with us what reasons were mentioned?
posted 2 weeks ago
I'll just give you big quote from the book:
As you can see, this is a run-of-the-mill Java domain class, defining the three properties needed to describe an ingredient. Perhaps the most unusual thing about the Ingredient class as defined above is that it seems to be missing the usual set of getter and setter methods, not to mention useful methods like equals(), hashCode(), toString(), and others. You don’t see them in the listing partly to save space, but also because you’re using an amazing library called Lombok to automatically generate those methods at runtime. In fact, the @Data annotation at the class level is provided by Lombok and tells Lombok to generate all of those missing methods as well as a constructor that accepts all final properties as arguments. By using Lombok, you can keep the code for Ingredient slim and trim.
Lombok isn’t a Spring library, but it’s so incredibly useful that I find it hard to develop without it. And it’s a lifesaver when I need to keep code examples in a book short and sweet.
Seem to be very weak arguments to use it. Hard to notice any actually. By the way, Lombok generates code at compile time, not runtime as the book suggests. I would recommend to forget this library in Java ecosystem and avoid using it.
posted 2 weeks ago
Liutauras Vilda wrote:Seem to be very weak arguments to use it. Hard to notice any actually. By the way, Lombok generates code at compile time, not runtime as the book suggests. I would recommend to forget this library in Java ecosystem and avoid using it.
Thank you for giving better clarification. Tho, I'm not using Lombok for the sake of Lombok, rather to follow up the author. It seems that he uses Lombok throughout the book.
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad: