简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM