maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahardy42 <adam.ha...@cyberspaceroad.com>
Subject ServiceLoader not loading FileTypeDetector implementation in jar
Date Thu, 04 Jan 2018 16:12:33 GMT
I created, tested and packaged a java.nio.file.spi.FileTypeDetector
implementation in a utility jar for use by Files.probeContentType(path). 

So it works beautifully in my utility project. 

I'm now trying to use it in another project but despite hours of trying, I
can't work out why the JVM can't find or load my implementation and keeps
defaulting back to the JDK's RegisterFileTypeDetector.

I have double checked that the utility jar is in my classpath with
dependency:tree, contains the
META-INF/services/java.nio.file.spi.FileTypeDetector file naming my
implementation, and also the actual implementation class.

The JDK javadoc documentation claims that it will seek it out anywhere on
the application's classpath:

https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html

but I only see it searching on the system classpath during debugging. 

My efforts are hampered by the use of nested arrays of Enumeration<URL> with
sun.misc.CompoundEnumeration. It's really convoluted and I haven't been able
to see where it fails.

What could I be doing wrong? 





--
Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message