簡體   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