且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

包装及运行带有弹簧的依赖Java应用程序

更新时间:2023-10-16 23:25:58

Java的部署仍是个愚蠢而乏味的2009年因此常见的选项是写这个小脚本。如果你把所有的JAR文件到一个目录(比如的lib \\ ),你可以使用自动构建classpath中常见的脚本(请参阅这个博客条目)。我建议在开始添加 CD / D%〜DP0 cd到脚本的目录。

Java deployment is still stupid and tedious in 2009. So the usual option is to write this small script. If you put all your JARs into one directory (say, lib\), you can use a common script which builds the classpath automatically (see this blog entry). I suggest to add a cd /d %~dp0 at the beginning to cd into the script's directory.

2的Maven有一个插件,它可以组装您的应用程序在一个超级JAR( MVN装配:装配)。这工作,除非您使用DB2 JCC驱动程序(其中包含被转换包com.ibm 的COM.ibm的 - > ClassNotFoundException的)

Maven 2 has a plugin which can assemble your application in one "super JAR" (mvn assembly:assembly). This works unless you use the DB2 JCC driver (which contains "COM.ibm." packages which get converted to com.ibm. -> ClassNotFoundException).

最后一个解决办法,如果你已经是ANT的build.xml这工作,就是要打开所有相关的JAR文件,并创建一个超级JAR自己。

The last solution, if you have already an ANT build.xml which works, is to unpack all the dependent JARs and create a "super JAR" yourself.