Arquillian + tomcat 6 + gradle

Version 2

    This is a quick reference on how to configure arquillian tests with a tomcat-6 container with gradle.

     

     

    configurations {
        inContainerTestRuntime { extendsFrom testRuntime }
    }
    
    dependences {
        // add any other dependencies you need
        inContainerTestRuntime 'org.apache.tomcat:dbcp:6.0.29',
                'org.jboss.weld.servlet:weld-servlet:1.1.0.Final',
                'org.jboss.arquillian.container:arquillian-tomcat-embedded-6:1.0.0.Alpha4',
                'org.jboss.arquillian:arquillian-spi:1.0.0.Alpha4.SP1',
                'org.jboss.arquillian.protocol:arquillian-protocol-servlet-3:1.0.0.Alpha4',
                'org.jboss.shrinkwrap:shrinkwrap-extension-tomcat-6:1.0.0-alpha-11'
    }
    
    sourceSets {
        inContainerTest {
            runtimeClasspath = sourceSets.test.runtimeClasspath + configurations.inContainerTestRuntime + sourceSets.test.resources
        }
    }
    
    task inContainerTest(type: Test) {
        classpath = sourceSets.inContainerTest.runtimeClasspath
        include '**/*InContainerTestSuite.*'
    }
    
    

     

     

    This has not been fully optimized yet, the runtimeClasspath for inContainerTest sourceSet is probably redundant (I think that sourceSets.test.runtimeClasspath includes resources)