[Jigsaw] Getting "Bad service configuration file" error with annotation processor

Gunnar Morling gunnar at hibernate.org
Tue Feb 9 18:08:55 UTC 2016


Many thanks for all the replies!

> or is it a "pre-Jigsaw"/"JDK8-style" processor with a service configuration file

Yes, it's a "pre-Jigsaw" processor; More specifically it's the JBoss
Logging processor (see [1], [2] for sources/binary), a tool which
creates I18N-capable logger classes from annotated interfaces. I am
building a module which contains such annotated interface.

Passing the processor and its dependencies through "-processorpath"
(instead of "-processormodulepath") did the trick in the end, so
thanks for that suggestion.

Note that one stumbling block was a NoClassDefFoundError related to
javax.annotation.Generated raised from within the processor: The
processor adds this annotation to the sources it generates and for
that purpose it accesses Generated.class. I added "requires
java.annotations.common" to the module-info.java of the module under
compilation (i.e. the module to which the processor is applied), but
this didn't help.

Eventually I could make it work by adding a JAR containing the JSR 250
classes to "-processorpath". But I am wondering whether that's the
right approach as these classes are provided by the JDK. Is there a
way to have modules such as "java.annotations.common" exposed to
"pre-Jigsaw" processors?



[1] https://github.com/jboss-logging/jboss-logging-tools/blob/2.0.1.Final/processor/src/main/java/org/jboss/logging/processor/apt/LoggingToolsProcessor.java
[2] http://search.maven.org/#artifactdetails|org.jboss.logging|jboss-logging-processor|2.0.1.Final|jar

More information about the compiler-dev mailing list