Java - dist和deploy文件夹之间的区别 [英] Java - Difference between dist and deploy folders

查看:415
本文介绍了Java - dist和deploy文件夹之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我一个新手的问​​题,但dist和deploy文件夹有什么区别?它似乎是一样的 - 都包含文件的.jar。但是,当您清理并构建项目时,看起来只有dist文件夹才会更新。部署文件夹如何更新?

Forgive me for a novice question, but what is the difference between the dist and deploy folders? It seems like the same thing - both contains the .jar of the files. However, when you clean and build the project, it looks like only the dist folder is updated. How does the deploy folder get updated?

谢谢。

推荐答案

我将假设您使用的目录布局类似于Netbeans IDE默认创建的目录布局。

I will assume that you are using a directory layout similar to what Netbeans IDE creates by default.


  • dist 是存储生成的档案的文件夹(因此会更新)通过清洁和建设)。

  • build 文件夹包含已编译的类和资源,但不包含压缩的存档。

  • dist is the folder where your generated archives are stored (so it gets updated through clean and build).
  • build folder contains compiled classes and resources, but not the compressed archives.

Maven默认情况下将两者的内容放入目标文件夹。

Maven, by default, places the content of both into a target folder.

deploy 文件夹是放置生成的工件的位置(存档或目录树具有相同的位置)作为存档的布局,又称为分解存档),以便您可以为Application Server提供服务。

A deploy folder is the place where you put your generated artifacts (either archives or directory trees with the same layout as archives, a.k.a. exploded archives) so that you Application Server can serve it.

在开发环境中,将服务器配置为扫描<$ c $并不罕见c> dist 生成工件的文件夹并重新部署它们。因此,从这个意义上说,deploy和dist文件夹可以是相同的。

In development environments it is not unusual to configure the server to scan the dist folders for generated artifacts and redeploy them. So, in that sense, deploy and dist folders can be the same.

您甚至可以拥有就地部署方案。这可以通过将类直接编译到 WEB-INF / classes 文件夹 webapp (与Maven <$ c之类的东西) $ c> war:inplace 目标)。如果将服务器设置为扫描此文件夹中的更改,则可以编辑jps等资源并将其立即反映到正在运行的应用程序中(a.k.a.爆炸工件热部署)。

You can even have "in place" deployment scenarios. This works by compiling your classes direct to WEB-INF/classes folder inside webapp (with something like Maven war:inplace goal). If you set your server to scan changes in this folder, you can edit resources such as jps in place and have it immediately reflected into your running application (a.k.a. exploded artifact hot deployment).

当然,您可以通过指示IDE将资源和已编译的类复制到展开的存档结构并配置服务器进行扫描来完成类似的操作。为此,Netbeans倾向于使用 build / web

Of course that you can accomplish something similar by instructing your IDE to copy resources and compiled classes to a exploded archive structure and configuring your server to scan it. Netbeans tends to use build/web for that purpose.

有时也无法进行增量重新部署,并且通常不需要完全重新部署(某些应用程序可能需要几分钟才能重新部署)。这就是为什么你可以使用单独的文件夹/将你的工件部署为罐子/战争/耳朵等等。

Also sometimes incremental redeployment is not possible and frequently full redeploys are not desirable (some applications may take several minutes to redeploy). That is why you can use separate folders / deploy your artifacts as jars / wars / ears, etc.

编译,打包和部署是Build的非常不同的阶段/概念生命周期,可能会也可能不会一起发生。

Compiling, packaging and deploying are very different phases / concepts of a Build lifecycle, which may or may not happen together.

我希望这足以让你前进。

I hope this is enough info to get you going.

干杯,

这篇关于Java - dist和deploy文件夹之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆