Empty file when serializing with Java Modules

12 views
Skip to first unread message

Davide Perini

unread,
Jul 10, 2020, 11:29:12 PM7/10/20
to jackson-user
this simple line of code:

mapper.writeValue(new File(path + File.separator + "FastScreenCapture.yaml"), config);

serialized my config object into a yaml file correclty.

If I try to use the java modules by simply adding this to the project in a module-info.java

module FastScreenCapture {

requires java.base;
requires java.desktop;
requires org.freedesktop.gstreamer;
requires static lombok;
requires org.mapstruct.processor;
requires com.sun.jna.platform;
requires com.sun.jna;
requires nrjavaserial;
requires org.eclipse.paho.client.mqttv3;
requires com.fasterxml.jackson.dataformat.yaml;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.datatype.jsr310;

}

jackson write an empty file.

any help?
why the module-info.java file should create this problem?

Tatu Saloranta

unread,
Jul 11, 2020, 9:48:23 PM7/11/20
to jackson-user
I don't have any good ideas based just on this piece of information
(esp. without value classes, which seem to
use Lombok for processing too). But maybe others have experience on this?
Inclusion of module-info will likely enable access/visibility checks
that are not used without that,
so ... perhaps you also need to add

requires com.fasterxml.jackson.annotation;

in case properties are not otherwise visible (no public getters)?

-+ Tatu +-
Reply all
Reply to author
Forward
0 new messages