This is due to the way persistence.xml works.
You can add an external jar to persistence.xml using the <jar-file>
element. The tricky bit is to make it work in Eclipse, where compiled classes are spread around different projects.
As suggested by this answer, you can do so with a relative "file:" url:
<persistence-unit name="myPersistenceUnit">
<jar-file>file:../../LibraryProject1/bin</jar-file>
<jar-file>file:../../LibraryProject2/bin</jar-file>
The "current folder" is the compiler output folder ("bin" in my case) i.e. the one containing META-INF if persistence.xml is located at /MainProject/src/main/resources/META-INF/persistence.xml