Compilation of a JSR330 class fails with RuntimeException #28
-
Hi, I am trying to compile a class and I get the following error
Can you please help 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hello! The jar that contains the package |
Beta Was this translation helpful? Give feedback.
-
You can add the classpath when you launch the ClassFactory.ClassRetriever` classRetriever = componentSupplier.getClassFactory().loadOrBuildAndDefine(
LoadOrBuildAndDefineConfig.forUnitSourceGenerator(unitSG)
//With this we are adding an external path where to search classes needed for class compilation and loading.
//It possible to add folder, .zip, .jar, .ear, .war, .jmod or .class files
//The difference between this method and .setClassRepository is that the method .addClassRepository will add
//paths to the configured defaults paths, instead the method .setClassRepository will replace the configured
//defaults paths and the subsequent calls to method .addClassRepository will add paths to the replacement paths
.addClassRepository(
pathHelper.getAbsolutePathOfResource("../../src/test/external-resources/libs-for-test.zip")
)
); However, I advise you to carefully read all the documentation relating to the runtime compilation module:
|
Beta Was this translation helpful? Give feedback.
-
... I noticed that the class |
Beta Was this translation helpful? Give feedback.
-
Weirdly I have the classes in my classpath (maven dependencies) and I could generate the source class without issue.
Thanks for the help ! |
Beta Was this translation helpful? Give feedback.
Weirdly I have the classes in my classpath (maven dependencies) and I could generate the source class without issue.
But the compilation fails.
To solve the error, I had to add the classpaths of the project wherein I want to store the compiled class. like this: