Bug 52267

Summary: Nested service element in WAR task puts service descriptor files in the wrong place in the .WAR.
Product: Ant Reporter: Esmond Pitt <esmond.pitt>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement CC: esmond.pitt
Priority: P2    
Version: 1.8.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   

Description Esmond Pitt 2011-11-30 22:46:29 UTC
Service descriptor files are loaded as class resources by java.util.ServiceLoader. Therefore they have to be in the classpath. If you specify <jar ...><service .../></jar> this works correctly: the service descriptor files are JAR'd as /META-INF/services/*. However in a WAR file this is not correct. At present if you specify <war ...><service/></war> the same happens as above. The correct location in a WAR file is /WEB-INF/classes/META-INF/services/*.
Comment 1 Stefan Bodewig 2011-12-02 16:12:00 UTC
You are correct but then again you are not correct to expect anything else based on the documentation 8-)

Some of the inherited pieces implemented by <jar> don't make much sense
in the context of <war> or <ear>.  The <services> element could, but currently
doesn't.

Using WEB-INF/classes in the case of <war> sounds good to me.