How to load external jar libraries into a Moqui project?

I am trying to integrate Apache Solr into Moqui. I cannot access the Solr API. I placed the solr jar in the framework / lib directory, but I get this exception when I try to start the service from the tools section.

Error running groovy script (org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during class generation: java.lang.NoClassDefFoundError: Unable to load class org.apache.solr.client.solrj.impl.HttpSolrClient due to missing dependency org/apache/http/entity/mime/content/ContentBody 

Is there any other configuration I need to do in order to use the Solr API?

+4
source share
1 answer

In general, it is better not to change anything in the framework directory, even configuration files, such as property files, should be overridden by adding them to the runtime / classes directory or to the / classes directory.

In this case, to have the jar from the framework / lib directory, you must add it to the framework / build.gradle file and then create the gradle construct so that the jar file is added to the Moqui WAR file.

The best approach is to add it to the runtime / lib directory, or even better, when using the jar file in your component code, add it to the / classes directory (in the "Moqui Applications appendix" more information about this).

More generally, why use Solr? ElasticSearch is part of Moqui and is used (and improved) through various infrastructure features.

0
source