Use apache poi (to read and write to .xlsx spreadsheet) for the customized plugin which implements BulkFileListener Follow
Answered
I have implemented a customized BulkFileListener, where I have implemented the @Override function public void after(@NotNull List<? extends VFileEvent> events). Based on certain conditions, I want to read/write to a xlsx spreadsheet using apache poi.
Let me know how to include appropriate dependencies in build.gradle file, so that I am able to successfully import org.apache.poi.xssf.usermodel.XSSFWorkbook;
Please sign in to leave a comment.
I got it working to compile & build successfully by including the following in the dependencies section of build.gradle file
However while running am getting the below error at the place where the XSSFWorkbook is instantiated.
java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
What could be the reason for this.?
Am I missing something important in the configuration
You'll need to figure out all required dependencies of this library according to its documentation. On a sidenote, this listener should not be used for heavy operations like writing to a file. So I suggest to just perform quick operations from it and update file contents asynchronously.
Ok. I will push all the heavy operations to a task which runs periodically to do the asyncronous tasks...
Let me know the class/interface that I need to extend/implement to invoke the scheduled task... A sample code snippet or appropriate links will help.
See https://plugins.jetbrains.com/docs/intellij/general-threading-rules.html#do-not-perform-long-operations-in-ui-thread "Don't do anything expensive inside event listeners. ..." paragraph