mave

基于maven maven-replacer-plugin 插件对JS,CSS统一加版本号

白昼怎懂夜的黑 提交于 2020-03-01 06:58:07
基于maven对JS,CSS统一加版本号 在写WEB应用的时候,每次对JS/CSS文件做的修改,对于用户来说,都很郁闷;一不注意,接到用户的投诉说:为啥我的不能用了。呃,浏览器缓存,麻烦您老清一下缓存。好吧,用户说了,我为啥要清;(每次升级,能挨个通知用户不?或者首页挂个广而告之:咱系统升级了,遇到不能用的时候,劳烦您老 Ctrl+F5 吧;真要这样,估摸着耳朵会红好多天的啊。。。) 其实浏览器缓存引发的JS、CSS的问题,是有办法搞定的;最狠的做法,就是禁止浏览器缓存,别缓存了,都来我服务器上拿吧;但这样的话,会造成服务器的负载过高,另外用户端由于每次访问页面都需要下载一波的JS、CSS文件,影响了体验,尤其是一些大的JS/CSS文件的时候; 当然,还有一种方法就是每次js/css文件有变动,就在引用的地方加上版本的控制,改个版本号;比如: <script src="http://xxx.com/js/a.js?v=110" type="text/javascript"> 这样的话,第一次因为请求的url不一样了,所以,每次还是会到服务器上拉取的。之后由于版本号不变了,那么浏览器的本地缓存又可以用了,减轻了服务器压力,也提升了加载速度。这个蛮好的; 但是,话说回来了,加版本号这事儿,让每个开发来做,有点不靠谱,而且,有遗漏也不好说呀;搞个自动的呗; 加版本号的方法

mave 配置文件里面的setting 配置仓库

久未见 提交于 2019-11-27 05:45:46
Using Mirrors for Repositories With Repositories you specify from which locations you want to download certain artifacts, such as dependencies and maven-plugins. Repositories can be declared inside a project, which means that if you have your own custom repositories, those sharing your project easily get the right settings out of the box. However, you may want to use an alternative mirror for a particular repository without changing the project files. Some reasons to use a mirror are: There is a synchronized mirror on the internet that is geographically closer and faster You want to replace a