简体   繁体   English

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

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

Please, someone help me, I'm desperate. 拜托,有人帮助我,我很绝望。 I've been trying all night. 我整夜都在努力。 The problem I have is this: Weird NoClassDef-s with Eclipse Jetty's Maven plugin 我的问题是: Eclipse Jetty的Maven插件奇怪的NoClassDef-s

Basically: I can't make recent versions of the Jetty plug-in to work properly in an integration test. 基本上:我无法使Jetty插件的最新版本在集成测试中正常工作。 Indeed, everything works fine until the Jetty's shutdown stage, when I'm told that org.eclipse.jetty.util.FutureCallback is missing. 确实,一切正常,直到Jetty关机,直到有人告诉我org.eclipse.jetty.util.FutureCallback丢失了。

I've included the dependencies told in the link above. 我已经在上面的链接中包含了依赖项。 Initially they were ignored, then I've added them in project/build/extensions. 最初它们被忽略,然后我将它们添加到了project / build / extensions中。 Now I've several other ClassNotFoundExceptions and I can't fix that. 现在,我还有其他几个ClassNotFoundExceptions,我无法解决。

This is what I have in my POM: 这就是我的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>

And these are the extesions I've set up: 这些是我设置的范围:

        <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} is defined in the parent and = 9.1.3.v20140225, but I've tried many, down to 7.x $ {jetty.version}在父级中定义,= 9.1.3.v20140225,但我尝试了很多,直到7.x

Moreover, Maven is 3.2.1, Java is 1.7.0_51, running on OS X 10.9.2 此外,Maven是3.2.1,Java是1.7.0_51,在OS X 10.9.2上运行

Thank you in advance for any help for this nasty issue. 预先感谢您对这个令人讨厌的问题的任何帮助。

I've found it!!! 我找到了!!! Apparently, the problem is the 'stop' goal is (rightly) attached to the 'post-integration-test' phase. 显然,问题在于“停止”目标(正确地)附加到“集成后测试”阶段。 So, if you issue 'mvn integration-test', such phase, as far as I understand, is not reached ( http://tinyurl.com/omwulm5 ). 因此,据我所知,如果您发布“ MVN集成测试”,则无法达到该阶段( http://tinyurl.com/omwulm5 )。 By just giving 'mvn verify' or 'install', and without adding any Jetty-related dependency to the POM (everything needed should now be included in 9.1.x), Maven completed without any complaint (hooray!). 通过仅提供“ mvn verify”或“ install”,并且不向POM添加任何与Jetty相关的依赖项(现在所需的所有内容都应包含在9.1.x中),Maven可以毫无抱怨地完成工作(万岁!)。

This might look silly to readers smarter than me, I'm reporting it nonetheless, just in case you're struggling as much as I've just done for hours. 对于那些比我更聪明的读者来说,这可能看起来很愚蠢,尽管如此,我还是在报道,以防万一您像我已经做了几个小时一样苦苦挣扎。

You should not be using the "run" goal with an execution binding. 您不应将“运行”目标与执行绑定一起使用。 Instead, you should be using the "start" goal. 相反,您应该使用“开始”目标。 See the documentation here: http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#jetty-start-goal 请参阅此处的文档: http : //www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#jetty-start-goal

The difference is that the "run" goal will run a fresh build up until the "test-compile" phase. 不同之处在于,“运行”目标将重新构建,直到“测试编译”阶段。 The "start" goal does not invoke a parallel build and simply runs at whatever phase it is bound to. “开始”目标不会调用并行构建,而只是在绑定到的任何阶段运行。

Jan 一月

Just try to add <stopWait>10</stopWait> to plugin configuration. 只需尝试将<stopWait>10</stopWait>到插件配置中即可。

Full configuration you can see in this answer . 您可以在此答案中看到完整的配置。

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

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