How to generate the reflect-config.json file for Aspose.Words?

Hi
in my GraalVM Gradle project, I’m using Aspose.Words (implementation ‘com.aspose:aspose-words:22.9:jdk17’). How can I generate the reflect-config.json file for Aspose.Words?

First, I used the following command:

java -agentlib:native-image-agent=config-output-dir=./config/ -jar demo.jar
This generated a reflect-config.json file. However, from my understanding, this file only includes the reflection classes that were actually used during execution. If I switch to another .doc file that uses different reflection classes, the reflect-config.json would be different, right? How can I solve this issue?

thank you

@imzdong

Can you please clarify what specific issue you are facing with the reflect-config.json file generation? Are you looking for a way to include all possible reflection classes for Aspose.Words in the generated file?

yes,

I hope to include all possible reflection classes of Aspose.Words in the generated file. How can I achieve this?

@imzdong I will consult with our java developers and get back to you soon.

@alexey.noskov thanks

@imzdong,

Indeed, since the GraalVM Tracing Agent only captures classes that were utilized during its runtime, it is essential to ensure maximum coverage of all possible usage scenarios for the library. To achieve this, you can:

  1. Create test examples for various document types and operations used in your application (e.g., opening, editing, saving in different formats).
  2. Run the agent for each scenario to generate configuration data.
  3. Merge the configurations after running all tests to create a unified setup.
  4. Manually add missing classes to the configuration files (e.g., reflect-config.json) if errors occur during the build due to omitted classes.

This approach ensures comprehensive reflection configuration for diverse use cases.

OK, thanks.Are there any other methods?
By traversing the package classes? Or other methods?

@imzdong I’m afraid there is no alternative solution we can suggest to achieve this.

ok, thanks a lot

1 Like