underwow中有一个名为HttpRequestParser
的类,它使用注释过程并应生成HttpRequestParser$$generated
。
首先,m2e-apt可以正常工作,因为它可以正确生成generated-sources
。
我尝试运行示例
Undertow server = Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler(new HttpHandler() {
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.getResponseSender().send("Hello World");
}
}).build();
server.start();
但是有错误
Mar 27, 2019 10:50:55 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Mar 27, 2019 10:50:55 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: io.undertow.server.protocol.http.HttpRequestParser$$generated
at io.undertow.Undertow.start(Undertow.java:247)
at io.github.fairjm.undertow.examples.HelloWorldServer.main(HelloWorldServer.java:20)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: io.undertow.server.protocol.http.HttpRequestParser$$generated
at io.undertow.server.protocol.http.HttpRequestParser.instance(HttpRequestParser.java:221)
at io.undertow.server.protocol.http.HttpOpenListener.<init>(HttpOpenListener.java:93)
at io.undertow.Undertow.start(Undertow.java:179)
... 1 more
Caused by: java.lang.ClassNotFoundException: io.undertow.server.protocol.http.HttpRequestParser$$generated
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.undertow.server.protocol.http.HttpRequestParser.instance(HttpRequestParser.java:216)
... 3 more
UndertowLogger_$logger
由m2e-apt生成,因此可以正常登录。
然后我尝试运行mvn clean compile
,然后在HttpRequestParser$$generated
中生成target\classes
(并且没有生成任何源)。
我需要做些什么使日食产生它们?