本文介绍了Maven插件可以自动生成setters/getters?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有Maven插件会自动生成带有相应JavaDoc的setter和getter吗?

Is there a Maven Plugin that will automatically generate setters and getters with the corresponding JavaDocs?

我知道,当您告诉Eclipse/Netbeans时,它将执行此操作;但是,对于源代码来说,仅包含骨骼并让Maven或其他工具生成重复的内容将是很好的选择.

I am aware that Eclipse/Netbeans will do this when you tell it to; however, it would be nice for the source to simply contain the skeleton and have Maven or another tool generate the repetitive stuff.

我想修改源代码,以便在调试时可以编译和使用源jar.

I would want to modify the source code so that a source jar can be compiled and used when debugging.

谢谢,沃尔特

推荐答案

这不一定是您希望Maven为您做的事情.由于IDE不一定知道所生成的代码,除非它具有能够理解Lombok表示法的插件,否则它将使在IDE中的代码处理变得更加困难. IntelliJ有这样的插件.

This isn't necessarily something that you want maven to do for you. It will make working with the code in the IDE harder, as the IDE won't necessarily know about the generated code unless it has a plugin that understands Lombok's notation. IntelliJ has such a plugin available.

也就是说, lombok项目旨在通过使用@Data注释正确地做到这一点.看起来效果很好,但是我还没有尝试过.它通过插件支持许多环境和IDE,包括Maven,Eclipse,IntelliJ和Netbeans.当前有一些关于Netbeans的警告,请参阅项目文档.

That said, project lombok aims to do this properly through the use of an @Data annotation. It looks like it works well, but I haven't tried it. It supports a number of environments and IDEs through plugins, including Maven, Eclipse, IntelliJ and Netbeans. There are a few caveats with Netbeans currently, see the project documentation.

这篇关于Maven插件可以自动生成setters/getters?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 05:39