question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid sorting on line break in artifactId value

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Ekrydcommented, Mar 30, 2021

Released SortPom version 2.14.1 with the bug fix. Enjoy!!

1reaction
Ekrydcommented, Mar 27, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

'groupId' with value 'IOCProj1(Basic)' does not match a valid id ...
According DefaultModelValidator class 'artifactId' and 'groupId' have to match following regular expression. ID_REGEX = "[A ...
Read more >
Make line breaks configurable (or preserve existing ... - GitHub
I have to replace all line break characters with the configured line breaks, otherwise strange things will happen when I write the sorted...
Read more >
POM Reference - Maven
The purpose of this computation is to select a version that matches all the dependency declarations (due to transitive dependencies, there can be...
Read more >
Configuring Logback with Spring Boot - CodinGame
Before we start looking at configuring Logback its worth having a quick ... %n - line break; %magenta() - sets the colour of...
Read more >
Spring Initializr Reference Guide
Out-of-the-box, a custom instance handles command-line requests using cURL or HTTPie . ... initializr: group-id: value: org.acme artifact-id: value: my-app ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found