You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was having a hard time getting my project to run correctly when built with this plugin, in particular I could not get log4j initialized correctly. I noticed the following logging statement coming from OneJar:
[JarClassLoader] INFO: log4j.properties in main/main.jar is hidden by lib/utils.jar (with different bytes)
It turned out that utils.jar had a log4j.properties file and I had just assumed that OneJar would prefer the one from main.jar. Reading the OneJar documentation closely, I noticed the section on resource loading includes the following caveat:
Note: this assumes that the Ant task is used to construct the One-Jar. Otherwise, embedded Jar resources are loaded in the order they appear in the "jar -tvf" listing.
Sure enough, running "jar tf" on the JAR produced by this plugin was listing all of the "lib" contents ahead of the "main/main.jar" entry.
Looking at the code I suspect this is the fault of a lexicographical sort on contents of staging directory. The OneJar Ant Task from the official project does not include in the main.jar in the staging area, instead it explicitly adds it as the first entry to the JAR file (running "jar tf" on a JAR from the Ant task confirms this). Perhaps if it would be possible to make a similar change here.
The text was updated successfully, but these errors were encountered:
I was having a hard time getting my project to run correctly when built with this plugin, in particular I could not get log4j initialized correctly. I noticed the following logging statement coming from OneJar:
It turned out that
utils.jar
had alog4j.properties
file and I had just assumed that OneJar would prefer the one frommain.jar
. Reading the OneJar documentation closely, I noticed the section on resource loading includes the following caveat:Sure enough, running "jar tf" on the JAR produced by this plugin was listing all of the "lib" contents ahead of the "main/main.jar" entry.
Looking at the code I suspect this is the fault of a lexicographical sort on contents of staging directory. The OneJar Ant Task from the official project does not include in the main.jar in the staging area, instead it explicitly adds it as the first entry to the JAR file (running "jar tf" on a JAR from the Ant task confirms this). Perhaps if it would be possible to make a similar change here.
The text was updated successfully, but these errors were encountered: