意识到较早发布了类似问题,但没有答案。 Uuse both a manifest.mf and also pass jars using cp?
谢谢,
最佳答案
What is the best way to define classpath in java batch environment ? Can both Manifest.MF and cp argument via Command line be used or Does one override the other or Does one takes precedence over the other ?
如今,通常会创建一个uber jarfile(一个将其所有依赖项一起包含在内),然后创建create an executable jar来利用 list 文件。
为了清楚起见,如果您使用
-cp
命令行选项,则仍需要指定包含应用程序入口点的要调用的类,即包含public static void main(String[] args)
的类。If I am using javaee-api jar instead of the actual jms* and xml* jars which are available on the server. Do I need to include each individual jar in the build.gradle as "runtime" ? for tracebility on the actual dependencies ? What would be the best practice ?
此处最好使用的范围是
provided
,因为这些库将由容器为您提供。Taking Continuous integration into account, should the server side dependency jars be packaged along with the application jar, so that its a standalone app ?!
现在这是非常普遍的做法,并且由于所有依赖项都 bundle 在一起,因此可以简化部署。这是Dropwizard web service framework采取的方法,使用Jetty作为嵌入式容器。
关于java - 在哪里定义服务器端jar的类路径? manifest.mf与CLI参数-cp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37956767/