@@ -264,10 +264,31 @@ spotless {
264264 eclipse('4.26').configFile('eclipse-prefs.xml')
265265 // if the access to the p2 repositories is restricted, mirrors can be
266266 // specified using a URI prefix map as follows:
267- eclipse().withP2Mirrors(['https://download.eclipse.org/eclipse/updates/4.29/':'https://some.internal.mirror/4-29-updates-p2/'])
268-
267+ eclipse().withP2Mirrors(['https://download.eclipse.org/eclipse/updates/4.29/':'https://some.internal.mirror/4-29-updates-p2/'])
269268```
270269
270+ Not only can you format your code with Eclipse JDT, but you can also sort the members as you know it from Eclipse IDE.
271+ This ensures that the methods are always in sorted order (and thus reduces the likelihood of collisions in a version
272+ control system). It is turned off by default, but you might want to consider enabling it when setting coding standards
273+ for the rest of the team.
274+
275+ The format to specify the sort order follows the ` outlinesortoption ` and ` org.eclipse.jdt.ui.visibility.order `
276+ properties that can be found in the workspace folder of your Eclipse IDE (look up the
277+ file ` .plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs ` in your workspace directory).
278+
279+ ``` gradle
280+ spotless {
281+ java {
282+ // specify the sort order of the member categories
283+ // SF,SI,SM,F,I,C,M,T = Static Fields, Static Initializers, Static Methods, Fields, Initializers, Constructors, Methods, (Nested) Types
284+ val memberCategoryOrder = "SF,SI,SM,F,I,C,M,T"
285+ val doNotSortFields = true
286+ eclipse().sortMembers(memberCategoryOrder, doNotSortFields)
287+ // optional: specify ordering of members of the same category by the visibility within the category
288+ // B,R,D,V = Public, Protected, Package, Private
289+ val visibilityOrder = "B,R,D,V"
290+ eclipse().sortMembers(membersSortOrder, doNotSortFields, visibilityOrder)
291+ ```
271292
272293### formatAnnotations
273294
0 commit comments