Wrong built WebArchive using Shrinkwrap Classpath resolution
replicant77 Oct 4, 2013 3:53 AMHi,
I have defined a simple war project and setup an arquillian test using shrinkwrap 2.0.0, that - as a test - just resolves the web archive via classpath resolution:
@RunWith(Arquillian.class) public class ShrinkwrapTestIT { @Deployment public static Archive<?> createDeployment() { WebArchive war = Maven.resolver() .resolve("shrinkwrap.test:shrinkwrap.test:war:0.0.1-SNAPSHOT").withClassPathResolution(true) .withoutTransitivity().asSingle(WebArchive.class); System.out.println(war.toString(true)); return war; } @Test public void test() { //do nothing } }
The output shows, that the archive is incomplete (resource files are missing) and not even war conform:
some_text_file.txt
com/
com/test/
com/test/Test.class
If i change the code to use .withClassPathResolution(false), the output is:
/some_text_file.txt
/index.jsp
/com/
/com/test/
/com/test/Test.class
/WEB-INF/
/WEB-INF/web.xml
/WEB-INF/sun-web.xml
/META-INF/
/META-INF/MANIFEST.MF
Now the resources are included, but the class(es) are packaged at the top level and not under /WEB-INF/classes
What am i doing wrong here? My pom looks like that:
<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>shrinkwrap.test</groupId> <artifactId>shrinkwrap.test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <properties> <project.build.sourceEncoding>ISO8859-1</project.build.sourceEncoding> <version.shrinkwrap.resolvers>2.0.0</version.shrinkwrap.resolvers> </properties> <dependencies> <!-- test dependencies --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> </dependency> <dependency> <groupId>org.jboss.arquillian.junit</groupId> <artifactId>arquillian-junit-container</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.container</groupId> <artifactId>arquillian-glassfish-remote-3.1</artifactId> <version>1.0.0.CR4</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.shrinkwrap.resolver</groupId> <artifactId>shrinkwrap-resolver-depchain</artifactId> <version>${version.shrinkwrap.resolvers}</version> <scope>test</scope> <type>pom</type> </dependency> </dependencies> <dependencyManagement> <dependencies> <!-- Override dependency resolver with latest version. This must go *BEFORE* the Arquillian BOM. --> <dependency> <groupId>org.jboss.shrinkwrap.resolver</groupId> <artifactId>shrinkwrap-resolver-bom</artifactId> <version>${version.shrinkwrap.resolvers}</version> <scope>import</scope> <type>pom</type> </dependency> <dependency> <groupId>org.jboss.arquillian</groupId> <artifactId>arquillian-bom</artifactId> <version>1.1.1.Final</version> <scope>import</scope> <type>pom</type> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.16</version> <configuration> <skipTests>${skipITs}</skipTests> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
Many thanks,
Gunther