The ordering of jars on the classpath between Gradle 1.3 and Gradle 1.10


(Mark Petrovic) #1

I spent a day in classpath purgatory tracking down a runtime error that I finally have a handle on. I’m not necessarily looking for an answer, because at this point I don’t think it really matters. But I wanted to air this in case I’m missing something important.

I’m in the process of migrating from Gradle 1.3 to Gradle 1.10. My project has about 270 jars on the classpath (ugh).

When I examine the runtime classpath in Gradle 1.3, this particular ordering of cglib and cglib-nodep obtains

/cglib/cglib-nodep/3.1/jar/aa83efbd1aedc4f26bdf00e7ea78191483f2c9b3/cglib-nodep-3.1.jar
/cglib/cglib/2.1_3/jar/d3851e366b9fe8b7d8215de0f9eb980b359d8de0/cglib-2.1_3.jar

and when I examine the runtime classpath with Gradle 1.10, this ordering obtains

/cglib/cglib/2.1_3/d3851e366b9fe8b7d8215de0f9eb980b359d8de0/cglib-2.1_3.jar
/cglib/cglib-nodep/3.1/aa83efbd1aedc4f26bdf00e7ea78191483f2c9b3/cglib-nodep-3.1.jar

You can see that they are flipped with respect to one another.

As an aside, the Gradle 1.10 ordering breaks my app at runtime, where cglib 2.1_3 wants to load a version of an ASM class that is not on the classpath.

I’m not sure what the right question to ask is, but this difference in ordering can be significant and I wanted to point it out should someone else see something in it.


(Luke Daley) #2

Hi Mark,

That’s always a nasty problem to debug. This change happened in 1.8 and was mentioned in the potential breaking changes in the release notes:

http://www.gradle.org/docs/1.8/release-notes#the-order-of-resolved-files-and-artifacts-has-changed

It wasn’t a decision we made lightly, but we were able to make way for some serious enough optimisations with this change that we decided to go for it.


(Mark Petrovic) #3

Got it. Thanks. I know jumping from Gradle 1.3 to Gradle 1.10 is a huge change, and I figured you guys knew about this. Glad the loop is closed, for me and posterity.