如何打包和部署 Eclipse Java 应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2555618/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How Do I Package and Deploy an Eclipse Java Application?
提问by Rick
I have built a Java application that has some dependencies (~10). I would like to easily package this application up and deploy it as a single file to a CD or USB drive.
我构建了一个具有一些依赖项(~10)的 Java 应用程序。我想轻松地打包此应用程序并将其作为单个文件部署到 CD 或 USB 驱动器。
There doesn't seem to be any "nice" wizard to search the project, grab the dependencies and setup the classpath on the target computer. I have to do this manually.
似乎没有任何“好的”向导来搜索项目、获取依赖项并在目标计算机上设置类路径。我必须手动执行此操作。
Is there a better way? Something simple, easy and straight-forward. A link to a tutorial on this would be great.
有没有更好的办法?一些简单、容易和直接的东西。有关此教程的链接会很棒。
Seems to me that this should be a built-in feature to eclipse. Deployment of a web application seems easy enough, but not a Java application.
在我看来,这应该是 eclipse 的内置功能。部署 Web 应用程序似乎很容易,但部署 Java 应用程序就不是那么容易了。
采纳答案by kgiannakakis
Have a look at the Fat Jar Plug-In.
看看Fat Jar 插件。
回答by Pyrolistical
That's because desktop deployment isn't well defined.
那是因为桌面部署没有明确定义。
You are heading into release issues which is a huge can of worms.
您正面临发布问题,这是一大堆蠕虫。
I assume you have some form of version control like SVN or git? If so check out maven with the release plugin and maven-assembly-plugin
我假设您有某种形式的版本控制,例如 SVN 或 git?如果是这样,请使用发布插件和 maven-assembly-plugin 查看 maven
It'll take a lot of work to setup, but once you get it going you'll be cross linking and deploying distribution packages in no time!
设置需要大量工作,但是一旦开始,您将立即进行交叉链接和部署分发包!
Plus you'll have access to the vast maven repos on the web right now
此外,您现在可以访问网络上的大量 Maven 存储库