How to check WAR content with separate Maven module using Arquillian
I found the cue ball and knowledge on the internet, but couldn't put it together to solve this specific case. This answer seems like a pretty good start, but it deals specifically with the EAR dependency.
My (simplified) maven project structure looks like this:
parent
|__domain (a jar)
|__domain-it (integration tests for the domain module)
|__web (a war; depends on domain)
|__web-it (integration tests for the web module)
I am looking for a solution for the following:
- I want to have integration tests in Arquillian that validate the code that contains the module
web
. - These tests will be contained in a separate module
web-it
. - Since a module
web
is module dependentdomain
, integration testsweb-it
must also have code from the moduledomain
in the classpath. - Both
domain
andweb
have dependencies on some third-party libraries, such asorg.apache.commons:commons-lang3
which will also be needed for the test path. - Tests should be run both via Maven on the command line and directly inside Eclipse via junit.
I am working on Glassfish 3.1.2.
Any help would be greatly appreciated. It is strange that there is no specific Arcillian documentation for this scenario, as I imagine it is quite common. Perhaps I am missing something fundamental?
Here are some of my attempts:
-
Make
web-it
dependent onweb
by adding the following to theweb-it/pom.xml
following:<dependency> <groupId>${project.groupId}</groupId> <artifactId>web</artifactId> <version>${project.version}</version> <scope>test</scope> <type>war</type> </dependency>
But this will not include classes from
web
in the test class path -
Make it
web-it
dependent on classesweb
by configuring the military plugin fromweb
before creating the bound class cluster . Inweb/pom.xml
:<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <attachClasses>true</attachClasses> </configuration> </plugin>
In
web-it/pom.xml
:<dependency> <groupId>${project.groupId}</groupId> <artifactId>web</artifactId> <version>${project.version}</version> <scope>test</scope> <classifier>classes</classifier> </dependency>
This includes classes from
web
in the test path, but none of the transitive dependencies (for examplecommons-lang3
).
I've also considered but haven't tried it yet:
- Using the Maven Warpath plugin as described in this answer . It looks like some problems occur when this is used with m2e / eclipse and I want to be able to run my integration tests from eclipse.
- Using MavenImporter ShrinkWrap Resolver it's somehow easy to create an Arquillian deployment based on the pom project. I'm not sure how this would work in eclipse (i.e. outside of maven), but it also means that I need to efficiently deploy the entire WAR and not just a subset of it - an Arkillian feature that I like and would like to be able to save.
source to share
No one has answered this question yet
See similar questions:
or similar: