Question

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

Basically: I can't make recent versions of the Jetty plug-in to work properly in an integration test. Indeed, everything works fine until the Jetty's shutdown stage, when I'm told that org.eclipse.jetty.util.FutureCallback is missing.

I've included the dependencies told in the link above. Initially they were ignored, then I've added them in project/build/extensions. Now I've several other ClassNotFoundExceptions and I can't fix that.

This is what I have in my 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

Moreover, Maven is 3.2.1, Java is 1.7.0_51, running on OS X 10.9.2

Thank you in advance for any help for this nasty issue.

Was it helpful?

Solution

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). 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!).

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.

OTHER TIPS

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

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.

Full configuration you can see in this answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top