Intellij IDEA必备插件,提高效率的“七种武器”

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"常言道“工欲善其事必先利其器”,作为一个程序员,一个好的IDE可以起到事半功倍的效果。"},{"type":"link","attrs":{"href":"https://snyk.io/wp-content/uploads/jvm_2020.pdf","title":""},"content":[{"type":"text","text":"2020 JVM 生态报告"}]},{"type":"text","text":"显示 Intellij IDEA 已经成为Java开发者的首选。Intellij IDEA的强大不止在于其本身提供的各种功能,也依赖于其插件体系为第三方提供了扩展能力。今天我就分享一下自己常用的插件,有了这些工具的帮助,写bug都比别人快一步(o´ω`o)。"}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"1.Maven Helper"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"作为最流行的Java应用构建工具,Maven在简化了依赖管理的同时,其依赖传递机制也可能在不经意间同时引入同一个依赖的多个版本造成依赖冲突,在不借助其他工具的情况下可以使用"},{"type":"codeinline","content":[{"type":"text","text":"maven dependency:tree"}]},{"type":"text","text":"命令查看依赖关系,但当依赖比较多时,这个效率是比较低的,借助Maven Helper插件可以更简单的发现冲突并解决。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在插件安装之后,打开pom.xml时在底部会多出一个 "},{"type":"text","marks":[{"type":"strong"}],"text":"Dependency Analyzer"},{"type":"text","text":"选项,如图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/b9/b90e03ad80b5775ad0a05d39ba87ddfa.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"勾选"},{"type":"text","marks":[{"type":"strong"}],"text":"Conflicts"},{"type":"text","text":"查看冲突,然后可以选择跳转到源码或直接排除。"}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"2.CodeGlance"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Sublime Text编辑器有一个"},{"type":"codeinline","content":[{"type":"text","text":"Minimap"}]},{"type":"text","text":"功能,可以在代码编辑区右侧显示代码缩略图,进行快速跳转。Intellij IDEA可以通过安装CodeGlance插件实现同样的功能。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"安装使用效果如下:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ef/efc43dd5e10edb4e882216c85dab81b0.gif","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.Free Mybatis plugin"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在使用MyBatis框架的时候,发现Mapper接口和XML文件之间跳转十分的麻烦,经常的操作是在Mapper接口中将接口名称复制一下,然后去查找对应的XML文件,打开后CRTL+F查找对应的xml实现,效率很低。安装"},{"type":"codeinline","content":[{"type":"text","text":"Free Mybatis plugin"}]},{"type":"text","text":"插件可以像Java代码一样直接跳转。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"效果图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/d2/d234bb8ddee788c17db3cf0c26a7c345.gif","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"此外,插件还能及时发现mapper文件和xml文件的潜在的问题,比如方法名不匹配、字段不存在等,如图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/76/767e4fc802824ae8ea75f7f598f68d9a.jpeg","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"4.Mybatis Log Plugin"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"使用MyBatis框架的时候,可以配置打印sql语句,但打印出来的是使用了占位符的预编译语句,我们通常需要手动将参数拼接上才能获取可以实际执行的sql语句。"},{"type":"codeinline","content":[{"type":"text","text":"Mybatis Log Plugin"}]},{"type":"text","text":" 插件可以自动将预编译语句转换为可执行的语句,这在查找问题的时候非常有用。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"效果图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/fa/fa70c5378d17124b3cc56289b738dfeb.gif","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"5.Grep Console"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"一般应用在运行的时候会产生大量的日志,不同级别的日志混杂在一起不容易区分且不好查找,以往的做法是通过自定义日志格式实现代码高亮,如图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/b7/b79a08e5a9013fe929668a793d9c8de7.jpeg","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这种方式麻烦且对代码有入侵,更好的方法是使用Grep Console插件为不同pattern的日志设置颜色。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"效果图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ed/edf4c53c25d8be2334931021bfc7f39d.jpeg","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"6.Gsonformat"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在实际开发中,经常会遇到将json格式字符串转换为Java Bean的情况,一般做法是新建一个类然后添加字段,费时费力不说还可能出错,Gsonformat插件可以解析json自动填充字段,支持嵌套结构。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"效果图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/e1/e1d39f284c1999a3ea30678ac8ada28f.gif","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在使用的时候可以勾选使用"},{"type":"codeinline","content":[{"type":"text","text":"Lombok"}]},{"type":"text","text":"注解,减少代码量。"}]}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"7.Rainbow Brackets"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Rainbow Brackets是一个简单但很有用的插件,它可以实现对不同层级括号使用不同的颜色高亮,增加辨识度,特别是在嵌套层级比较多或者代码缩进不规范的时候作用更明显。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"效果图:"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ff/ffc4b0fef478a447e1cea7c62b7bbe77.jpeg","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"总结"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Intellij IDEA 的插件机制为开发者提供了更多的可能,使用官方提供的 "},{"type":"text","marks":[{"type":"strong"}],"text":"Intellij Platform Plugin SDK"},{"type":"text","text":" 你也可以自己开发一个插件玩玩。如果你发现一些好用的插件,也可以通过留言分享出来。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最新、更多漫画请关注微信公众号:码农神说。转载开白可联系助手,微信号:codeceo-01"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"相关阅读"}]},{"type":"bulletedlist","content":[{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/d49e5aa412e022cb6afc48656","title":""},"content":[{"type":"text","text":"接住喽,送你个装逼技能:JDK 动态代理"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/b8c67ad20a1aa039c8312e0e8","title":""},"content":[{"type":"text","text":"给“小白”漫画 + 图示讲解 MyBatis 原理,就问香不香!"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/81029df24c99eb5911edf3bbb","title":null},"content":[{"type":"text","text":"辟谣:程序员不配谈恋爱?你错的可以!真相来了"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/41846b3fa362bbef382c6babf","title":null},"content":[{"type":"text","text":"面试官:CAP 都搞不清楚,别跟我说你懂微服务!"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/b7195f780e45dd68a827dffb1","title":null},"content":[{"type":"text","text":"看看吧!28岁退休的程序员和P8都干了啥"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/56c1c92104e7b4e0ae67ddfca","title":null},"content":[{"type":"text","text":"千万不能让程序员给娃娃取名字"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/8dfe1ea299db76c33e37a4056","title":null},"content":[{"type":"text","text":"漫画 | 啊哈,给我一碗孟婆汤"}]}]}]},{"type":"listitem","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://xie.infoq.cn/article/c2c7ecc71c17ec054e9c62fd3","title":null},"content":[{"type":"text","text":"漫画 | 人工智能之机械基"}]}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章