拜托,有人帮助我,我很绝望。我整晚都在努力。我遇到的问题是:Weird NoClassDef-s with Eclipse Jetty's Maven plugin
基本上:我无法使最新版本的 Jetty 插件在集成测试中正常工作。事实上,一切正常,直到 Jetty 的关闭阶段,当我被告知缺少 org.eclipse.jetty.util.FutureCallback 时。
我已经包含了上面链接中提到的依赖项。最初它们被忽略,然后我将它们添加到项目/构建/扩展中。现在我有其他几个 ClassNotFoundExceptions,但我无法修复它。
这是我的 POM 中的内容:
<plugins>
<!-- This is activated before tests and uses the overlay import mechanism -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<systemProperties>
<!-- Triggers test data creation in uk.ac.ebi.fg.myequivalents.webservices.server.test.WebTestDataInitializer -->
<systemProperty>
<name>uk.ac.ebi.fg.myequivalents.test_flag</name>
<value>true</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<useTestScope>true</useTestScope>
<httpConnector>
<!-- 8080 is often busy on EBI hosts -->
<port>10973</port>
</httpConnector>
<stopPort>10974</stopPort>
<stopKey>KILL</stopKey>
</configuration>
<executions>
<!--
starts jetty before tests and stops it afterwards. Note that no stop goal is needed, it magically stops
after tests
-->
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
这些是我设置的扩展:
<extensions>
<extension>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
</extension>
<extension>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>${jetty.version}</version>
</extension>
<extension>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<version>${jetty.version}</version>
</extension>
<extension>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<version>${jetty.version}</version>
</extension>
</extensions>
${jetty.version} 定义在parent and = 9.1.3.v20140225,但我试过很多,低至7.x
另外,Maven是3.2.1,Java是1.7.0_51,运行在OS X 10.9.2
预先感谢您对这个棘手问题的任何帮助。
最佳答案
我找到了!!!显然,问题是“停止”目标(正确地)附加到“后集成测试”阶段。因此,如果您发出“mvn 集成测试”,据我所知,这样的阶段还没有达到(http://tinyurl.com/omwulm5)。只需提供“mvn verify”或“install”,而不向 POM 添加任何与 Jetty 相关的依赖项(现在需要的一切都应包含在 9.1.x 中),Maven 完成而没有任何提示(万岁!)。
对于比我聪明的读者来说,这可能看起来很愚蠢,但我还是要报告它,以防万一您像我刚刚几个小时所做的那样苦苦挣扎。
关于java - 再次使用 Eclipse Jetty 的 Maven 插件的 NoClassDef-s,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22851637/