自动化:通过Launch Configuration,Eclipse导出runnable jar

时间:2014-04-14 15:34:53

标签: java eclipse bash jar

我使用Eclipse开发Java代码。当我想要一个可运行的jar时,我指向并点击GUI,如下所示:

文件 - >导出 - > Runnable Jar - >启动配置(选择MainTest)--LibraryHandling(将所需的库提取到生成的JAR中)

我想自动执行此操作,如何在bash中执行此操作?

1 个答案:

答案 0 :(得分:0)

根据项目中的内容以及您拥有的依赖项,使用Java提供的命令行工具可能会非常复杂。 The Java tutorial is pretty good in explaining the usage of the related tools that ship with Java to create jars,但我认为大多数人建议使用Maven或Gradle等构建工具进行命令行构建。

如果您正在使用jar工具,那么指定可运行Main类的jar工具的最基本示例是:

jar cmf existing-manifest jar-file input-file(s)

其中existing-manifest将是指定主类的清单文件。