Just wanted to know if it is possible in Eclipse to sort Maven dependencies by alphabetical order?
It’s bothering me to have a list of 200 jars not ordered… 🙁
I guess you refer to the m2eclipse plugin. You have these options:
The order in the navigator is the classpath order. You can sort the dependencies in the POM to get a better list. Of course, there is a problem with transient dependencies.
You can open the POM file in the POM editor and examine the dependencies in the tab “Dependency Hierarchy”
You can type part of the name of a dependency to locate it when the tree item “Maven Dependencies” is open.
Maven’s Pom viewer will do the trick:
pom.xml you care about. Eclipse opens it in a special viewer with five tabs on the bottom: Overview, Dependencies, Dependency Hierarchy, Effective POM, and pom.xml.
Dependency Hierarchy. You should see the following on the right side of the view:
I just ran into the Sortpom Maven Plugin. This enables you to sort the dependencies in your pom using a Maven command. So you can use it in Eclipse, but also in any other IDE (I’m using NetBeans where you can configure it as custom goal definition).
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort -Dsort.sortDependencies=groupId,artifactId
At the GitHub wiki you can find all parameters.
But as pointed out in the comments, sorting like this isn’t a good idea. Let your IDE take care of it. NetBeans has a “Dependencies” folder in a project where the dependencies are shown sorted by default (first by type, then by name).
have a look at the project properties in the ‘java build path’ section under the ‘libraries’ tab.
i don’t know for sure if this works for the m2eclipse plugin.