[jbosstools-issues] [JBoss JIRA] (JBIDE-16696) IllegalStateException when Arquillian deployment uses Maven resolver

Snjezana Peco (JIRA) issues at jboss.org
Thu Mar 6 13:11:34 EST 2014


    [ https://issues.jboss.org/browse/JBIDE-16696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12950837#comment-12950837 ] 

Snjezana Peco commented on JBIDE-16696:
---------------------------------------

{quote}
By default, all relative paths are relative to current directory. Scanning could not fix that. 
{quote}

Shrinkwrap resolver could search for relative paths in the current working directory and, in case the requested path isn't found, in the directory mentioned in the shrinkwrap.project.home system property.
Arquillian Eclipse would set the shrinkwrap.project.home property to the project's home before executing a deployment method.

{quote}
However, what we could do is to use Maven.configureResolverViaPlugin(). This way Eclipse/JBDS will need just to setup a few system properties (pom.xml file, settings.xml file, active profiles etc) and user does not have to handle with it anymore.
{quote}

That won't solve the issue if a user uses the loadPomFromFile method.
BTW, the maven.execution.pom-file property isn't mentioned in the documentation.

{quote}
where did you got your pom.xml file? Depchain should be used, see adding shrinkwrap resolvers to your project at - https://github.com/shrinkwrap/resolver/blob/master/README.asciidoc - this is also related to missing Service.
{quote}

I have used the code described in the description of this jira.
                
> IllegalStateException when Arquillian deployment uses Maven resolver
> --------------------------------------------------------------------
>
>                 Key: JBIDE-16696
>                 URL: https://issues.jboss.org/browse/JBIDE-16696
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: testing-tools
>    Affects Versions: 4.1.1.Final
>            Reporter: Rich DiCroce
>            Assignee: Snjezana Peco
>
> In an Arquillian test class, if the @Deployment method uses the ShrinkWrap Maven Resolver API, the method will be marked with the following warning and the Arquillian Cruiser view does not show the deployment:
> {noformat}
> java.lang.IllegalStateException: There is more then a one service for serviceClass org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem(project=arquillian-bug-test)
> {noformat}
> There is no stack trace to indicate how the problem might be happening. At first, I thought this might be a ShrinkWrap bug, but this exception doesn't occur when I actually run the test. Eclipse shows only one implementation of MavenResolverSystem on the classpath.
> Example test class to reproduce the problem:
> {code}
> package test;
> import org.jboss.arquillian.container.test.api.Deployment;
> import org.jboss.arquillian.junit.Arquillian;
> import org.jboss.shrinkwrap.api.Archive;
> import org.jboss.shrinkwrap.api.ShrinkWrap;
> import org.jboss.shrinkwrap.api.spec.WebArchive;
> import org.jboss.shrinkwrap.resolver.api.maven.Maven;
> import org.junit.Test;
> import org.junit.runner.RunWith;
> @RunWith(Arquillian.class)
> public class ARQJBTBugTest {
> 	@Test
> 	public void test() {
> 		
> 	}
> 	
> 	@Deployment
> 	public static Archive<?> createDeployment() {
> 		return ShrinkWrap.create(WebArchive.class)
> 				.addAsLibraries(Maven.resolver()
> 						.loadPomFromFile("pom.xml")
> 						.importRuntimeDependencies()
> 						.resolve()
> 						.withTransitivity()
> 						.asFile());
> 	}
> 	
> }
> {code}
> And the POM to go with it:
> {code:xml}
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
> 	<modelVersion>4.0.0</modelVersion>
> 	<groupId>com.lapis.throwaway</groupId>
> 	<artifactId>arquillian-bug-test</artifactId>
> 	<version>0.0.1-SNAPSHOT</version>
> 	<packaging>war</packaging>
> 	<properties>
> 		<project.build.sourceEncoding>
> 			UTF-8
> 		</project.build.sourceEncoding>
> 		<version.arquillian_core>1.1.3.Final</version.arquillian_core>
> 	</properties>
> 	<dependencies>
> 		<dependency>
> 			<groupId>junit</groupId>
> 			<artifactId>junit</artifactId>
> 			<version>4.10</version>
> 			<scope>test</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.arquillian.junit</groupId>
> 			<artifactId>arquillian-junit-container</artifactId>
> 			<scope>test</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.shrinkwrap.resolver</groupId>
> 			<artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId>
> 			<scope>test</scope>
> 		</dependency>
> 	</dependencies>
> 	<dependencyManagement>
> 		<dependencies>
> 			<dependency>
> 				<groupId>org.jboss.arquillian</groupId>
> 				<artifactId>arquillian-bom</artifactId>
> 				<version>${version.arquillian_core}</version>
> 				<type>pom</type>
> 				<scope>import</scope>
> 			</dependency>
> 		</dependencies>
> 	</dependencyManagement>
> 	<build>
> 		<plugins>
> 			<plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 				<artifactId>maven-compiler-plugin</artifactId>
> 				<version>2.5.1</version>
> 				<configuration>
> 					<source>1.7</source>
> 					<target>1.7</target>
> 				</configuration>
> 			</plugin>
> 			<plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 				<artifactId>maven-surefire-plugin</artifactId>
> 				<version>2.12</version>
> 			</plugin>
> 		</plugins>
> 	</build>
> </project>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list