Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用Arquillian从单独的Maven模块测试战争内容_Java_Maven_Integration Testing_Jboss Arquillian - Fatal编程技术网

Java 如何使用Arquillian从单独的Maven模块测试战争内容

Java 如何使用Arquillian从单独的Maven模块测试战争内容,java,maven,integration-testing,jboss-arquillian,Java,Maven,Integration Testing,Jboss Arquillian,我在网络上找到了一些零碎的知识,但还没能把它们组合起来解决这个具体案例。这似乎是一个很好的开始,但它专门处理耳朵依赖 我的(简化的)maven项目结构如下: parent |__domain (a jar) |__domain-it (integration tests for the domain module) |__web (a war; depends on domain) |__web-it (integration tests for the

我在网络上找到了一些零碎的知识,但还没能把它们组合起来解决这个具体案例。这似乎是一个很好的开始,但它专门处理耳朵依赖

我的(简化的)maven项目结构如下:

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)
<dependency>  
    <groupId>${project.groupId}</groupId>
    <artifactId>web</artifactId>
    <version>${project.version}</version>
    <scope>test</scope>
    <type>war</type>
</dependency>
我正在寻找以下问题的解决方案:

  • 我想进行Arquillian集成测试,测试
    web
    模块包含的代码
  • 这些测试将包含在单独的
    web it
    模块中
  • 由于
    web
    模块依赖于
    domain
    模块,因此
    web it
    集成测试也需要将
    domain
    模块中的代码放在类路径上
  • domain
    web
    都依赖于某些第三方库,例如
    org.apache.commons:commons-lang3
    在测试类路径上也需要它
  • 测试需要在命令行上通过Maven运行,并通过junit直接在Eclipse中运行
  • 我正在用Glassfish 3.1.2跑步

    任何帮助都将不胜感激。我觉得奇怪的是,这个场景没有特定的Arquillian文档,因为我认为这是一个非常常见的场景。也许我遗漏了一些基本的东西

    以下是我迄今为止尝试过的一些方法:

  • 通过将以下内容添加到
    web it/pom.xml
    中,使
    web it
    依赖于
    web
    ,如下所示:

    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)
    
    <dependency>  
        <groupId>${project.groupId}</groupId>
        <artifactId>web</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
        <type>war</type>
    </dependency>
    
    web it/pom.xml
    中:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
            <attachClasses>true</attachClasses>
        </configuration>
    </plugin>
    
    <dependency>  
        <groupId>${project.groupId}</groupId>
        <artifactId>web</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
        <classifier>classes</classifier>
    </dependency>
    
    
    ${project.groupId}
    ,如中所述。但是,在m2e/eclipse中使用它时,似乎存在一些问题,我希望能够从eclipse运行集成测试
  • 以某种方式使用创建基于项目pom的Arquillian部署。我不确定这将如何在eclipse中运行(即在maven之外),但这也意味着我需要有效地部署整个战争,而不仅仅是它的一个子集——我喜欢并且希望能够保留Arquillian的一个特性

  • 你使用什么版本的maven war插件<代码>附件类
    从2.1-alpha-2开始提供