Dependency resolution with gradle for Arquillian tests


(albyanez) #1

Are there any examples or recommendations on how to use gradle to resolve dependencies for Arquillian tests? I can run Aquillian with Gradle without problems until my tests need dependencies outside of my project classes.


(Luke Daley) #2

How does Arquillian looking for dependencies? Is it just using the JVM classpath? Or can you specify via a system property or something similar?


(albyanez) #3

Arquillian uses Shrinkwrap’ Resolution. The ShrinkWrap Maven Resolver allows you to specify Maven dependencies. http://www.jarvana.com/jarvana/view/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.1.0-alpha-2/shrinkwrap-resolver-api-maven-1.1.0-alpha-2-javadoc.jar!/org/jboss/shrinkwrap/resolver/api/maven/MavenDependencyResolver.html

Shrinkwrap allows you to create an archive by manually adding the dependencies your test needs. This is cumbersome and a distraction since I want to use Arquillian for Integration Tests. Therefore, I want all my project’s dependencies. One can use the ShrinkWrap Maven Resolver to reuse the POM that is used for the build. The solution I am looking for is to use build.gradle instead. O/w I have to create a POM that duplicates my Gradle dependencies. I have had success running a bunch of Arquillian tests with Spock for a Gradle based project. The problem appears when my tests need 3rd party libraries. At that moment I need Shrinkwrap to do some dependency resolution to add the needed libraries. I have not found any examples using Gradle and Shrinkwrap Resolver.

Thanks,


(Luke Daley) #4

Hi Alberto,

I had a look at the documentation you linked to. I know understand what you mean.

There’s no easy answer here I’m afraid. Someone would have to write the Gradle equivalent of the Maven support you linked to above. They’d use the Gradle Tooling API (the embedded Gradle library) to read the Gradle project in order to get a hold of the dependencies used by the project. This is all very doable, so we just need somebody to write the code :slight_smile:

Fancy writing the Gradle plugin for Arquillian? :slight_smile:


(mmatloka) #5

Hello, https://issues.jboss.org/browse/SHRINKRES-116 I’m starting work on ShrinkWrap Resolver Gradle integration. However I need a small tip - how to get Project interface instance basing on build.gradle file using embedded gradle (core package from maven repos?)

Thanks


#6

Can you please post a new topic for this?


(mmatloka) #7

Sorry, new topic created http://forums.gradle.org/gradle/topics/embedding_gradle_retrieving_project_info