Confused on using this with Maven in a Modular Project with module-info.java #343
Unanswered
spencerdille
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Does this project support modularity? I would greatly appreciate any insight for anyone that has implemented this into their project and how they bypassed this. Thanks! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have been scratching my head over this one for a few days. There appears to be a slight change from the example code in the tutorial to what actually pulls into my project for 3.0. I have a modular project using JDK 17. So I first try and add version 3.0 to my project using Maven with the instructions given:
org.jxls jxls-poi 3.0.0This part works just fine. When I try the example code from the website, I had to modify it slightly because it no longer asks for a type 'File' for the output like in the example, instead it asks for a type JxlsOutput for the output file:
so instead of:
JxlsPoiTemplateFillerBuilder.newInstance()
.withTemplate("template.xlsx")
.build()
.fill(data, new File("report.xlsx"));
I have to use this:
JxlsPoiTemplateFillerBuilder.newInstance()
.withTemplate("template.xlsx")
.build()
.fill(data, new JxlsOutput() {
@OverRide
public OutputStream getOutputStream() throws IOException {
return new FileOutputStream("report.xlsx");
}
});
Here is where my problem comes in. In my module-info.java file, it asks me to use 'requires jxls.poi' to be able to use the JxlsPoiTemplateFillerBuilder class. It then also asks me to use 'requires jxls' to be able to use JxlsOutput. So I add them into my module-info.java file like this:
requires jxls.poi;
requires jxls;
But now when I go to build the project, I get the following errors:
java: module jxls.poi reads package org.jxls.common from both jxls and jxls.poi
java: module jxls.poi reads package org.jxls.command from both jxls and jxls.poi
java: module jxls reads package org.jxls.common from both jxls.poi and jxls
java: module jxls reads package org.jxls.command from both jxls.poi and jxls
Can someone who has completed this type of implementation help me out? Is there a way around removing the second 'requires' statement as that appears to break my project. It seems like the change from allowing a straight 'File' object to the JxlsOutput object breaks this. I'm sure it's something dumb that I am missing, but I would appreciate any help I can get from the experts here.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions