[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.m2e] Re: Question or suggestion: sorting dependencies?

Yves Schumann wrote:
We've got some projects with a huge list of dependencies. Because of the
amount of entries this list is not really usable, especially if a
dependency should be found. This is the case on the list of dependencies
on the pom-Editor and on the Maven dependency list on the project itself.
You can use the search field at the top of the editor to search/locate/filter the dependency list. Is it not sufficient?
Some of our developers made the suggestion, that it would be very nice,
if this list could be sorted. So what do you think about a sort function
on the pom-Editor? The best solution would be sorting by two columns:
Sorting by GroupID and/or sorting by ArtifactID.

The next point is, that the entries listed on the Maven dependencies on
the project itself are using the same order than given on the pom file.
But on this location I think the situation is a little bit more complex.
After a dependency out of the pom file you can see at first the
dependencies of this dependency and after that the next dependency out
of the pom file. Understand what I try to describe?

Let's say, that in the pom file the two jar's "foo.jar" and "bar.jar"
are given as dependencies. The first dependency "foo.jar" has a
dependency to "doom.jar". This appears on the Maven dependency list on
the project in this order:

- foo.jar
- doom.jar
- bar.jar

As you can see, with a huge amount of dependencies of dependencies
a.s.o. this would be very confusing. If this list could be sorted, the
usage would be way more clear:

- bar.jar
- doom.jar
- foo.jar

Any sentiments on this suggestion?
The order of resolved dependencies is controlled by Maven and it can't be changed by any other means other then editing your pom.xml (i.e. change order there and explicitly declare transitive dependencies). Note that order of dependencies affects the actual classpath, e.g. if there are two jars with the same class name, the JVM or compiler will only see the first one, but if you change the order, then it would see the other one. It means that just by sorting those dependencies in pom.xml you can easily break the build, so I would recommend to use such sorting with high caution.

 regards,
 Eugene