java代码里.dist是什么意思,Java - dist和deploy文件夹之间的区别

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?

Thanks.

解决方案

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

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, by default, places the content of both into a target folder.

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.

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.

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).

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.

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.

Cheers,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值