sortpom: Invalid sorting on line break in artifactId value
Settings:
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>2.13.1</version>
<configuration>
<keepBlankLines>true</keepBlankLines>
<createBackupFile>false</createBackupFile>
<expandEmptyElements>false</expandEmptyElements>
<sortModules>true</sortModules>
<sortDependencies>scope,groupId,artifactId</sortDependencies>
<sortProperties>true</sortProperties>
<sortPlugins>groupId,artifactId</sortPlugins>
<spaceBeforeCloseEmptyElement>false</spaceBeforeCloseEmptyElement>
</configuration>
</plugin>
Before sorting:
<dependency>
<groupId>foo.bar</groupId>
<artifactId>baz</artifactId>
</dependency>
<dependency>
<groupId>foo.bar</groupId>
<artifactId>
foo.bar.veryLongArtifactId
</artifactId>
</dependency>
After first sorting:
<dependency>
<groupId>foo.bar</groupId>
<artifactId>foo.bar.veryLongArtifactId
</artifactId>
</dependency>
<dependency>
<groupId>foo.bar</groupId>
<artifactId>baz</artifactId>
</dependency>
On restart:
<dependency>
<groupId>foo.bar</groupId>
<artifactId>baz</artifactId>
</dependency>
<dependency>
<groupId>foo.bar</groupId>
<artifactId>foo.bar.veryLongArtifactId
</artifactId>
</dependency>
But after formatting:
<dependency>
<groupId>foo.bar</groupId>
<artifactId>
foo.bar.veryLongArtifactId
</artifactId>
</dependency>
<dependency>
<groupId>foo.bar</groupId>
<artifactId>baz</artifactId>
</dependency>
Does not change on subsequent launches.
But baz I expect first.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (10 by maintainers)
Commits related to this issue
- #99 Trim texts in elements before sorting by text. Added test for line break sorting bug. Added temporary integration tests for line break bug. — committed to Ekryd/sortpom by deleted user 3 years ago
- Merge pull request #102 from Ekryd/issue-99-Invalid_sorting_on_line_break_in_artifactId_value #99 Trim texts in elements before sorting by text. Added test for lin… — committed to Ekryd/sortpom by Ekryd 3 years ago
Released SortPom version 2.14.1 with the bug fix. Enjoy!!
So it is the google style plugin that reinserts the line breaks. No way around that unless you have shorter artifactIds.
But the other issue is a bug. Good job finding it! The dependencies should be sorted correctly on the first pass, I’ll get to it and try to solve it
Cut off the same part, yes that’s brilliant 😄 , thanks!