You're using an old and deprecated version of the failsafe plugin. I don't think it works with Maven 3. failsafe-m-p is now found at Apache Maven (not Codehaus Mojo): http://maven.apache.org/plugins/maven-failsafe-plugin/
Upgrade and retry! /Anders On Fri, Jan 14, 2011 at 20:27, Neil Chaudhuri <[email protected]>wrote: > I have upgraded from Maven 2.20 to 3.02, and I found many of my integration > tests that used to pass are now failing because of a ClassCastException, > which is an odd exception to find when no code has changed. I traced the > issue to a classloader problem with Maven 3 that arises in another Java > library (RESTEasy if you were wondering). > > Here is their code: > > try > { > Object delegate = > FactoryFinder.find(JAXRS_RUNTIME_DELEGATE_PROPERTY, > JAXRS_DEFAULT_RUNTIME_DELEGATE); > if (!(delegate instanceof RuntimeDelegate)) > { > Class pClass = RuntimeDelegate.class; > String classnameAsResource = pClass.getName().replace('.', '/') > + ".class"; > ClassLoader loader = pClass.getClassLoader(); > if (loader == null) > { > loader = ClassLoader.getSystemClassLoader(); > } > URL targetTypeURL = loader.getResource(classnameAsResource); > throw new LinkageError("ClassCastException: attempting to cast" + > > delegate.getClass().getClassLoader().getResource(classnameAsResource) + > "to" + targetTypeURL.toString()); > } > return (RuntimeDelegate) delegate; > } > catch (Exception ex) > { > throw new RuntimeException(ex); > } > > And here is my pom configuration: > > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>failsafe-maven-plugin</artifactId> > <version>2.4.3-alpha-1</version> > <configuration> > <useSystemClassLoader>false</useSystemClassLoader> > <useManifestOnlyJar>false</useManifestOnlyJar> > <forkMode>once</forkMode> > <includes> > > <include>**/CategoriesServiceDelegateIT.java</include> > </includes> > </configuration> > <executions> > <execution> > <id>integration-test</id> > <goals> > <goal>integration-test</goal> > </goals> > </execution> > <execution> > <id>verify</id> > <goals> > <goal>verify</goal> > </goals> > </execution> > </executions> > </plugin> > > When I set useSystemClassLoader to true, the ClassCastException goes away, > but then nothing happens except for a hard exit. I see nothing in the logs > or in failsafe-reports to tell me what happened. > > Any insight into why things work in Maven 2.20 but not in 3.02 is > appreciated. > > Thanks. >
