I am stuck very badly in a very simple implementation of an Arquillian test case. I followed Can I add jars to maven 2 build classpath without installing them? to add my project jars to maven repository. I am using Glassfish server as my application server.
Then I need to write arquillian test cases.
For that I used the following code
@Inject
private ControllerLoginModule controllerloginmodule;
@Deployment
public static WebArchive createDeployment()
{
File[] lib = Maven.resolver()
.resolve("com.controllerjars:controllerbeans:1.0.0","com.controllerjars:controllerapi:2.0.0","com.controllerjars:controllerauth:1.0.0")
.withTransitivity().as(File.class);
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(ControllerLoginModule.class,AuthRealm.class,IAccountManagerInternal.class)
.addAsLibraries(lib)
.addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
.addAsWebInfResource(new StringAsset("<web-app></web-app>"), "web.xml");
}
@Test
public void testIsDeployed()
{
Assert.assertNotNull(controllerloginmodule);
}
Basically I am loading some jars which contains Classes Under Test and the classes on which those classes depends. In the end I am trying to create a web archive out of it. Then I try to test that wether object is null or not.
The issue which I can figure out from the stack trace is the deployment is not able to find the files from Maven. Below is the stack trace observed when I try to run the test case.
java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive com.appdynamics.auth.ControllerLoginModuleTest.createDeployment()
at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:160)
at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:94)
at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:57)
at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:156)
... 50 more
Caused by: java.lang.RuntimeException: Could not create new descriptor instance
at org.jboss.shrinkwrap.resolver.api.DependencyBuilderInstantiator.createFromUserView(DependencyBuilderInstantiator.java:101)
at org.jboss.shrinkwrap.resolver.api.DependencyResolvers.use(DependencyResolvers.java:39)
at com.appdynamics.auth.ControllerLoginModuleTest.createDeployment(ControllerLoginModuleTest.java:51)
... 55 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jboss.shrinkwrap.resolver.api.DependencyBuilderInstantiator.createFromUserView(DependencyBuilderInstantiator.java:96)
... 57 more
Caused by: java.lang.NoSuchMethodError: org.codehaus.plexus.DefaultPlexusContainer.lookup(Ljava/lang/Class;)Ljava/lang/Object;
at org.jboss.shrinkwrap.resolver.impl.maven.MavenRepositorySystem.getRepositorySystem(MavenRepositorySystem.java:220)
at org.jboss.shrinkwrap.resolver.impl.maven.MavenRepositorySystem.<init>(MavenRepositorySystem.java:64)
at org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl.<init>(MavenBuilderImpl.java:105)
... 62 more
I can't understand where and what I am missing. I have updated the entries for dependencies given in the Can I add jars to maven 2 build classpath without installing them?. Any help is greatly appreciated. Thanks.
Below is my pom
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Model Information -->
<modelVersion>4.0.0</modelVersion>
<!-- Artifact Information -->
<groupId>com.auth</groupId>
<artifactId>controller.functionaltest</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- Properties -->
<properties>
<version.shrinkwrap.resolver>2.0.0-beta-2</version.shrinkwrap.resolver>
<version.junit>4.11</version.junit>
<version.arquillian_core>1.0.3.Final</version.arquillian_core>
<project.basedir>/controller.functionaltest</project.basedir>
<version.org.jboss.shrinkwrap>1.1.2</version.org.jboss.shrinkwrap>
</properties>
<!-- Dependency Management -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>${version.shrinkwrap.resolver}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.arquillian_core}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Dependencies -->
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>${version.arquillian_core}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.controllerjars</groupId>
<artifactId>commonscollections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.controllerjars</groupId>
<artifactId>commonutil</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.controllerjars</groupId>
<artifactId>controllerapi</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.controllerjars</groupId>
<artifactId>controllerauth</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.controllerjars</groupId>
<artifactId>controllerbeans</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<type>pom</type>
<version>2.0.0-beta-2</version>
</dependency>
</dependencies>
<!-- Repositories -->
<repositories>
<repository>
<id>JBOSS_NEXUS</id>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>repo</id>
<url>file://${project.basedir}/src/main/resources</url>
</repository>
</repositories>
<!-- Plugin Configuration -->
<build>
<finalName>controller.functionaltest</finalName>
<!-- Compiler -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<!-- Plugin Management -->
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>[2.1,)</versionRange>
<goals>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>GLASSFISH_REMOTE_3.1_(REST)</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<extensions>false</extensions>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>7.1.3.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>~/JBOSS_Managed</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-remote-3.1</artifactId>
<version>1.0.0.CR3</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>JBOSS_AS_MANAGED_7.X</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<extensions>false</extensions>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>7.1.3.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>~/JBOSS_Managed</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.1.3.Final</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
below is my Dependency tree .
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building controller.functionaltest 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ controller.functionaltest ---
[INFO] com.appdynamics.auth:controller.functionaltest:pom:1.0.0-SNAPSHOT
[INFO] +- org.jboss.spec:jboss-javaee-6.0:pom:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.resource:jboss-connector-api_1.5_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.0.Final:provided
[INFO] | | \- javax.xml:jaxrpc-api:jar:1.1:provided
[INFO] | +- org.jboss.spec.javax.el:jboss-el-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.enterprise.deploy:jboss-jad-api_1.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.security.auth.message:jboss-jaspi-api_1.0_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.registry:jboss-jaxr-api_1.0_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.servlet.jsp:jboss-jsp-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.rpc:jboss-jaxrpc-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- javax.activation:activation:jar:1.1:provided
[INFO] | +- javax.enterprise:cdi-api:jar:1.0-SP4:provided
[INFO] | +- com.sun.faces:jsf-api:jar:2.0.3-b05:provided
[INFO] | +- javax.inject:javax.inject:jar:1:provided
[INFO] | +- javax.jws:jsr181-api:jar:1.0-MR1:provided
[INFO] | +- javax.mail:mail:jar:1.4.2:provided
[INFO] | +- javax.servlet:jstl:jar:1.2:provided
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.resteasy:jaxrs-api:jar:2.1.0.GA:provided
[INFO] | +- stax:stax-api:jar:1.0.1:provided
[INFO] | \- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] +- junit:junit:jar:4.11:test (scope not updated to runtime)
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.jboss.arquillian.junit:arquillian-junit-container:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.junit:arquillian-junit-core:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.test:arquillian-test-api:jar:1.0.3.Final:test
[INFO] | | \- org.jboss.arquillian.core:arquillian-core-api:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.test:arquillian-test-spi:jar:1.0.3.Final:test
[INFO] | | \- org.jboss.arquillian.core:arquillian-core-spi:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.container:arquillian-container-test-api:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.container:arquillian-container-test-spi:jar:1.0.3.Final:test
[INFO] | | \- org.jboss.arquillian.container:arquillian-container-spi:jar:1.0.3.Final:test
[INFO] | | \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-base:jar:2.0.0-alpha-3:test
[INFO] | +- org.jboss.arquillian.core:arquillian-core-impl-base:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.test:arquillian-test-impl-base:jar:1.0.3.Final:test
[INFO] | +- org.jboss.arquillian.container:arquillian-container-impl-base:jar:1.0.3.Final:test
[INFO] | | +- org.jboss.arquillian.config:arquillian-config-api:jar:1.0.3.Final:test
[INFO] | | +- org.jboss.arquillian.config:arquillian-config-impl-base:jar:1.0.3.Final:test
[INFO] | | \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-spi:jar:2.0.0-alpha-3:test
[INFO] | \- org.jboss.arquillian.container:arquillian-container-test-impl-base:jar:1.0.3.Final:test
[INFO] +- com.controllerjars:commonscollections:jar:3.2.1:compile
[INFO] +- com.controllerjars:commonutil:jar:1.0.0:compile
[INFO] +- com.controllerjars:controllerapi:jar:2.0.0:compile
[INFO] +- com.controllerjars:controllerauth:jar:1.0.0:compile
[INFO] +- com.controllerjars:controllerbeans:jar:1.0.0:compile
[INFO] \- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:pom:2.0.0-beta-2:compile
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api:jar:2.0.0-beta-2:compile
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-spi:jar:2.0.0-beta-2:compile
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:jar:2.0.0-beta-2:compile
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:jar:2.0.0-beta-2:runtime
[INFO] | +- org.sonatype.aether:aether-api:jar:1.13.1:runtime
[INFO] | +- org.sonatype.aether:aether-impl:jar:1.13.1:runtime
[INFO] | +- org.sonatype.aether:aether-spi:jar:1.13.1:runtime
[INFO] | +- org.sonatype.aether:aether-util:jar:1.13.1:runtime
[INFO] | +- org.sonatype.aether:aether-connector-wagon:jar:1.13.1:runtime
[INFO] | +- org.apache.maven:maven-aether-provider:jar:3.0.4:runtime
[INFO] | +- org.apache.maven:maven-model:jar:3.0.4:runtime
[INFO] | +- org.apache.maven:maven-model-builder:jar:3.0.4:runtime
[INFO] | +- org.apache.maven:maven-repository-metadata:jar:3.0.4:runtime
[INFO] | +- org.apache.maven:maven-settings:jar:3.0.4:runtime
[INFO] | +- org.apache.maven:maven-settings-builder:jar:3.0.4:runtime
[INFO] | +- org.codehaus.plexus:plexus-interpolation:jar:1.14:runtime
[INFO] | +- org.codehaus.plexus:plexus-utils:jar:2.0.6:runtime
[INFO] | +- org.apache.maven.wagon:wagon-provider-api:jar:2.2:runtime
[INFO] | +- org.apache.maven.wagon:wagon-file:jar:2.2:runtime
[INFO] | \- org.apache.maven.wagon:wagon-http-lightweight:jar:2.2:runtime
[INFO] | \- org.apache.maven.wagon:wagon-http-shared4:jar:2.2:runtime
[INFO] | +- org.jsoup:jsoup:jar:1.6.1:runtime
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.1.2:runtime
[INFO] | \- commons-io:commons-io:jar:2.0.1:runtime
[INFO] \- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven-archive:jar:2.0.0-beta-2:runtime
[INFO] +- org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.1:runtime
[INFO] | +- org.jboss.shrinkwrap:shrinkwrap-api:jar:1.0.1:runtime
[INFO] | \- org.jboss.shrinkwrap:shrinkwrap-spi:jar:1.0.1:runtime
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven-archive:jar:2.0.0-beta-2:runtime
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-spi-maven-archive:jar:2.0.0-beta-2:runtime
[INFO] +- org.codehaus.plexus:plexus-compiler-javac:jar:2.1:runtime
[INFO] | \- org.codehaus.plexus:plexus-compiler-api:jar:2.1:runtime
[INFO] \- org.codehaus.plexus:plexus-component-api:jar:1.0-alpha-33:runtime
[INFO] \- org.codehaus.plexus:plexus-classworlds:jar:1.2-alpha-10:runtime
I think the cause of this problem is due to ambiguous ShrinkWrap Resolver dependencies. You should declare the ShrinkWrap Resolver Bill of Materials in the dependency Management chain before the Arquillian BOM. I recommend using the ShrinkWrap Resolver 2.0.0-beta-2.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>2.0.0-beta-2</version>
<scope>test</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
<type>pom</type>
</dependency>
</dependencyManagement>
In the dependency section you need to have the following dependencies present:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<type>pom</type>
<version>2.0.0-beta-2</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
The ShrinkWrap Resolver 2.0.0-beta-2 provides a new API for resolving artifacts, so you need to make sure you use that particular API, such as:
File lib = Maven.resolver()
.resolve("artifact-groupid:artifact-artifactid:version")
.withoutTransitivity()
.asSingle(File.class);
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClass(MyClass.class)
.addAsLibrary(lib)
.addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
.addAsWebInfResource(new StringAsset("<web-app></web-app>"), "web.xml");
I've created an example project containing the bare minimums needed to make use of ShrinkWrap Resolver which makes use of the configuration and code above, however running in an embedded TomEE container. You can find it here: https://github.com/tommysdk/showcase/tree/master/arquillian-shrinkres. Hopefully this can help you to straight out the correct dependencies and versions needed.