Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Behaviour of @MetaInfServices annotation(I am missing services from META-INF/services)
Behaviour of @MetaInfServices annotation [message #1849288] Tue, 11 January 2022 08:27 Go to next message
Eclipse UserFriend
Hello,

I have a project that has 3 classes the implement a service interface "example.MyService". They all use the same annotation, something like (in 3 separate files):

@MetaInfServices(MyService)
public class MyServiceImplA implements MyService {
//...

@MetaInfServices(MyService)
public class MyServiceImplB implements MyService {
//...

@MetaInfServices(MyService)
public class MyServiceImplC implements MyService {
//...


The problem is that when eclipse compiles this, I expect to get a META-INF/services/example.MyService with all 3 classes (MyServiceImplA, MyServiceImplB, MyServiceImplC). Instead, only one of the 3 classes is present in the file. The other two are missing.

If I compile from command-line using maven, that produces a proper services file with all 3, so standard Java/Maven outside Eclipse seem to work fine.

What could be causing this? Any ideas what to check/change in order to fix this?
Re: Behaviour of @MetaInfServices annotation [message #1849304 is a reply to message #1849288] Wed, 12 January 2022 05:05 Go to previous message
Eclipse UserFriend
I just tried it with the latest Eclipse and 1.8 meta-inf library and I see all files getting processed. I see the following in the services file:

MyServiceImplA
MyServiceImplB
MyServiceImplC

You may want to try with a more recent Eclipse if you aren't doing that already. Also, do you see anything in the problem view or error log? May be the compilation is interrupted for some reason?
Previous Topic:Editor window flickers
Next Topic:Error: Could not find or load main class sun.applet.AppletViewer
Goto Forum:
  


Current Time: Wed Nov 05 10:57:22 EST 2025

Powered by FUDForum. Page generated in 0.03265 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top