开发者

Is there a way to let maven configure code templates in eclipse?

开发者 https://www.devze.com 2023-02-09 09:39 出处:网络
eclipse has the possibility to configure code templates per project. These are stored in /.settings/org.eclipse.jdt.ui.prefs.

eclipse has the possibility to configure code templates per project. These are stored in /.settings/org.eclipse.jdt.ui.prefs.

when you have a maven project you usually omit all eclipse project stuff and only keep the pom.xml. Then you check it out in eclipse and the m2eclipse plugin generates the project files. Maven even writes the above /.settings/org.eclip开发者_运维问答se.jdt.ui.prefs.

The problem with this approach is that every developer needs to specify the same templates for the project, since the pom.xml does not know about templates, and so maven does not write them to the prefs file.

I googled for eclipse maven code template and found only that the maven-eclipse plugin is capable of defining a code style in eclipse, but i did not find anything about templates.

  1. Does anybody know of a maven plugin which can solve this?
  2. Any workarounds or other solutions for this?


I use workspacemechanic to share my eclipse settings between different workspaces. Sharing code templates (Window->Preferences->Java->Editor->Templates) seems to work too. Its an eclipse plugin you have to install, no maven plugin.

0

精彩评论

暂无评论...
验证码 换一张
取 消