繁体   English   中英

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

[英]NoClassDef-s with Eclipse Jetty's Maven plugin, again

拜托,有人帮助我,我很绝望。 我整夜都在努力。 我的问题是: Eclipse Jetty的Maven插件奇怪的NoClassDef-s

基本上:我无法使Jetty插件的最新版本在集成测试中正常工作。 确实,一切正常,直到Jetty关机,直到有人告诉我org.eclipse.jetty.util.FutureCallback丢失了。

我已经在上面的链接中包含了依赖项。 最初它们被忽略,然后我将它们添加到了project / build / extensions中。 现在,我还有其他几个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}在父级中定义,= 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可以毫无抱怨地完成工作(万岁!)。

对于那些比我更聪明的读者来说,这可能看起来很愚蠢,尽管如此,我还是在报道,以防万一您像我已经做了几个小时一样苦苦挣扎。

您不应将“运行”目标与执行绑定一起使用。 相反,您应该使用“开始”目标。 请参阅此处的文档: http : //www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#jetty-start-goal

不同之处在于,“运行”目标将重新构建,直到“测试编译”阶段。 “开始”目标不会调用并行构建,而只是在绑定到的任何阶段运行。

一月

只需尝试将<stopWait>10</stopWait>到插件配置中即可。

您可以在此答案中看到完整的配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM