Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: how does order of dependencies make a difference?

I reordered my dependencies in build.gradle in alphabetical order, after which I quickly noticed that my Spring application no longer works properly (it halts with message java.lang.NoSuchMethodError: javax.servlet.ServletContext.getClassLoader() on start up). If I move the undertow dependency from the middle to the top, then everything works fine as before.

How does dependency ordering affect the way the application is run? What is the suggested order?

like image 215
David Frank Avatar asked Aug 03 '16 16:08

David Frank


1 Answers

It has an influence on the classpath of the application. There is probably an older version of Servlet specification above undertown dependency. This answer explains why this particular error occurs for older Servlet specification.

like image 94
Nicolas Henneaux Avatar answered Sep 29 '22 02:09

Nicolas Henneaux