I have a Java application which I can run in Eclipse or build and deploy with Gradle. I’m dealing with a difference in runtime behavior between running from Eclipse and running from a deployed build, so I’m trying to make sure that the runtime classpath with all the dependencies on 3rd party JARs is the same in both cases (which most certainly is not).
In Eclipse, I can decide the priority of each JAR on the classpath by manually changing the order of the classpath entries. When the app starts from Eclipse, ‘System.getProperty(“java.class.path”)’ actually returns the entries in that order.
But in the deployed build, all those JARs just get copied into a ‘lib’ folder. When the app starts, ‘System.getProperty(“java.class.path”)’ just returns ‘.’ which I imagine means that ‘lib’ folder. I believe in this case the priority of each JAR on the classpath is given by the alphabetical order of the file names of the JARs, however my first question is whether I’m right about this.
Another question is how to make Gradle build in such a way that when I run the deployed build the runtime classpath will be the same as it is in Eclipse.