How to make benas/jPopulator work with lombok

In my project I am using lombok library to hide boilerplate part of the code. Currently I am trying to auto-generate loads of data, so I'v selected benas/jPopulator library for this - it seems exactly what I need.

The problem is that I am getting following exception:

java.lang.NoSuchMethodException: Property '***' has no setter method in class ***

While there are no other setters and getters, but Lombok's one it seems that jPopulator doesn't see them. While code is compiled well and application is running completely fine.

Are there ways to make these 2 libs work together?

UPDATE It seems that the issue is not with jPopulator itself but with underlying library org.apache.commons.beanutils.PropertyUtilsBean, which can't find accessor method and fails. On another side in master version of jPopulator guys started to set properties on their own:

https://github.com/benas/jPopulator/blob/jpopulator-1.2.0/src/main/java/io/github/benas/jpopulator/impl/PopulatorImpl.java#L185 vs

https://github.com/benas/jPopulator/blob/master/jpopulator-core/src/main/java/io/github/benas/jpopulator/impl/PopulatorImpl.java#L260

The only question is there a way to use master version via maven?

Answers


As discussed in issue 42, the problem is with lombok's @Accessors(chain = true) which generates fluent getters and setters that are not compliant with Java Bean standard definition. That's why apache common's PropertyUtils.setProperty does not find the standard setter.

jPopulator is intended to populate standard Java Beans.

In regards to how to use the current snapshot version via maven central, it is documented here.

Hope this helps. Kind regards. Mahmoud


Need Your Help

Get ServletContext in JAX-RS resource

tomcat servlets java-ee jax-rs application-variables

I'm playing around with JAX-RS, deploying on Tomcat. It's basically: