I am new to java so not sure I fully understand jar files.
I want to put some common code in a library jar, which I then use from applications that are in different jars
This should be marked as a duplicate of this question I just came across
It is the exact problem and solution, which I could not find with all my previous searching until I knew exactly what I was searching for, i.e. Executable JAR ignores its own Class-Path attribute
So not a java problem at all but a maven problem and the usual sparse maven documentation sheds no light on the problem at all. Unfortunately the sample config I copied included the setting, which by default is turned off. Final solution, don't use indexing with the maven plugin.