Hi there,
I’ve been using the application plugin and generating distributions using distZip. I’m using a standard directory layout (main/src/java) with nothing particularly special, you can see the build.gradle here:
https://github.com/andrewhayden/archive-patcher/blob/master/tools/transformer/build.gradle
The project is a subproject, When I build dist from the root, the resulting ZIP archives contain incorrect logic for constructing the classpath. Instead of APP_HOME/lib/.jar, I see entries of the form APP_HOME/bin/lib/.jar, which are wrong.
Actual directory layout (result of extracting distribution into /tmp):
/tmp/archivepatcher-tools-transformer-1.0/bin/tools/transformer
/tmp/archivepatcher-tools-transformer-1.0/lib/archivepatcher-tools-transformer-1.0.jar
(and more JARs, omitted for brevity)
Notice the extraneous “tools” directory in the bin path that is not present in the lib path. This almost certainly has crept in from the subdirectory in which the subproject resides, in my case tools/transformer.
The wrapper script generates a CLASSPATH that looks like this:
/tmp/archivepatcher-tools-transformer-1.0/bin/lib/archivepatcher-tools-transformer-1.0.jar:
Notice that the CLASSPATH has “/bin/lib” instead of simply “/lib” in the path to the JAR.
It looks like the wrapper script contains logic to find the program’s parent directory and uses that as APP_HOME, which is the basis for constructing the CLASSPATH. In this case because the parent directory is “/tmp/archivepatcher-tools-transformer-1.0/bin/tools/transformer” instead of just “/tmp/archivepatcher-tools-transformer-1.0/bin/transformer” (note the missing “tools”), we end up with that extra “bin” hanging off the end. Whoops!
I don’t think I’ve done anything particularly weird in my build files, but the github link above shows everything. This is broken in Gradle 2.9 and Gradle 2.10. I haven’t tried Gradle 2.11-RC3 but have no reason from the changelog to think that it is fixed there,
Perhaps I’ve done something wrong somewhere? This should “just work”, without any modifications by me, I would think.