Java 11 で jetty-maven-plugin を使用すると問題が発生します。プラグインの依存関係で Java 11 互換の asm バージョンを明示的に指定しようとしました。
私の設定:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.12.v20180830</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>6.2.1</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.2.1</version>
</dependency>
</dependencies>
<configuration>
<httpConnector>
<port>9090</port>
</httpConnector>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
<webApp>
<contextPath>/</contextPath>
</webApp>
<jvmArgs>-Dfile.encoding=UTF-8</jvmArgs>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
これは失敗します
....
Caused by: java.lang.UnsupportedOperationException
at org.objectweb.asm.ClassVisitor.visitNestHostExperimental (ClassVisitor.java:158)
at org.objectweb.asm.ClassReader.accept (ClassReader.java:541)
at org.objectweb.asm.ClassReader.accept (ClassReader.java:391)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass (AnnotationParser.java:933)
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry (AnnotationParser.java:917)
at org.eclipse.jetty.annotations.AnnotationParser.lambda$parseJar$0 (AnnotationParser.java:876)
at java.util.TreeMap$ValueSpliterator.forEachRemaining (TreeMap.java:2890)
at java.util.stream.ReferencePipeline$Head.forEach (ReferencePipeline.java:658)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar (AnnotationParser.java:872)
at org.eclipse.jetty.annotations.AnnotationParser.parse (AnnotationParser.java:836)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call (AnnotationConfiguration.java:163)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run (AnnotationConfiguration.java:471)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:683)
at java.lang.Thread.run (Thread.java:834)
別の asm バージョン (6.1.1 など) を試すと、次のエラーで失敗します。
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 55
at org.objectweb.asm.ClassReader.<init> (ClassReader.java:166)
at org.objectweb.asm.ClassReader.<init> (ClassReader.java:148)
at org.objectweb.asm.ClassReader.<init> (ClassReader.java:136)
at org.objectweb.asm.ClassReader.<init> (ClassReader.java:237)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass (AnnotationParser.java:932)
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry (AnnotationParser.java:917)
at org.eclipse.jetty.annotations.AnnotationParser.lambda$parseJar$0 (AnnotationParser.java:876)
at java.util.TreeMap$ValueSpliterator.forEachRemaining (TreeMap.java:2890)
at java.util.stream.ReferencePipeline$Head.forEach (ReferencePipeline.java:658)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar (AnnotationParser.java:872)
at org.eclipse.jetty.annotations.AnnotationParser.parse (AnnotationParser.java:836)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call (AnnotationConfiguration.java:163)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run (AnnotationConfiguration.java:471)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:683)
at java.lang.Thread.run (Thread.java:834)
jetty maven プラグインを Java 11 で実行する方法はありますか?