[jetty-user] [Jetty Maven Plugin] Not pulling in Test scope dependencies when useTestScope is true

Nathan Schile <[email protected]> Sun, 4 Mar 2012 21:18:39 -0600
Newsgroups gmane.comp.java.jetty.support
Message-ID <CAB9Vy=CLjV7PwRNmZuJiy4MOpvFrFZk3u75f_7BEdYxSVc_CKQ@mail.gmail.com>
I have the plugin configured to pull in test classes and
dependencies[1], however it doesn't seem to be pulling in my test
dependencies.  I am receiving a NoClassDefFoundError on the class from
a test dependency, if I switch the dependency to a scope of compile,
it works fine.

My use case is that I have a jar that contains JAX-RS resources.  I am
using the Jersey Maven Plugin to do integration testing using embedded
Jetty.  I have a web.xml in /src/test/webapp/WEB-INF/, and have test
dependencies that mock out some services.  The mock services are only
found when they are pulled in using a "compile" scope.  I would
however like these dependencies to have a scope of "test" since they
are only used for testing.

Any ideas?

[1] useTestScope
http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Configuring_additional_parameters

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.0.v20120127</version>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <stopPort>${reserved.tomcat.stop.port}</stopPort>
                            <stopKey>foo</stopKey>
                            <daemon>true</daemon>
                            <contextPath>/${project.artifactId}</contextPath>
                            <useTestScope>true</useTestScope>
                            <connectors>
                                <connector
implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                                    <port>${reserved.tomcat.port}</port>
                                    <maxIdleTime>60000</maxIdleTime>
                                </connector>
                            </connectors>

<webXml>${basedir}/src/test/webapp/WEB-INF/web.xml</webXml>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <configuration>
                            <stopPort>${reserved.tomcat.stop.port}</stopPort>
                            <stopKey>foo</stopKey>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email