-1

我想在启动我的 java 项目时包含并启动 solr 服务器,然后,当您单击一个按钮时,我将运行一个使用 solr 服务器的 python 程序。

我已经完成了它,当我在 Eclipse 中启动它时它可以工作,但是当我将所有内容打包到可运行的 jar 文件中时它不起作用。我首先期望的是启动包含的 solr 服务器并将其打包到可运行的 jar 中。当服务器运行时,我将尝试 python 调用。

4

1 回答 1

0

I think you are trying to package solr libraries into your own jar. With just Java it is not possible, it only works with war and ear files. But there are two other possibilities: when using spring boot, you can package fat jar with orher jars inside using spring boot maven plugin, or you can use maven shade plugin to repackage compiled classes into your jar from other jars.

Or you can do it the old school way - put jars you are dependent on into a directory and specify those jars in java classpath startup param/specify classpath in jar manifest.

于 2019-06-04T07:23:53.293 回答