java - 再次使用 Eclipse Jetty 的 Maven 插件的 NoClassDef-s

标签 java maven jetty

拜托,有人帮助我,我很绝望。我整晚都在努力。我遇到的问题是: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/

相关文章:

java - 使用 eclipse 设置 jetty 8 以使用 servlet

java - 使用 Jetty Content Exchange 和 SSL 时是什么原因导致 "broken pipe"?

java - 如何在 Eclipse 中将 "sysout"片段与选定的文本一起使用?

java - DeadLock 在批量 DELETE 预准备语句 MYSQL 中发现错误

java - java 二维数组升序冒泡排序

java - 如何使用zookeeper作为基于spring的Web应用程序的数据源来加载属性?

maven - 有没有办法在多个单独的模块上执行 "mvn clean install",当所有模块都有不同的不能更改的父项时?

Maven 构建 [警告] 我们有一个重复的类

java - 在 jetty 停止之前调用函数

java - 在 Java 中使用随机森林打印实际和预测的类标签