首页 > 解决方案 > Arquillian 测试的“包不存在”

问题描述

对于我的 Java 应用程序,有一些函数是从 wsdl 文件下载的,并放在名为 java_DVLP 的文件夹中用于开发,而 java_PROD 则用于生产。这是通过我的 pom.xml 文件中的以下代码完成的:

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>3.4.2</version>
    <executions>
        <execution>
            <id>CTIE.GU</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>src/main/java_${classifier}</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${guCodeUrl}</wsdl>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

创建的文件夹通过以下方式添加:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>3.2.0</version>
    <executions>
        <execution>
            <phase>generate-test-sources</phase>
            <goals>
                <goal>add-test-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>src/main/java_DVLP</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

这工作正常。

我如何创建 Arquilian 测试以及尝试执行它们时 maven 告诉我:

Caused by: org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporterException: Unable to compile sources at C:\java\dev\gitroot\pdv\src\main\java due to following reason(s): /C:/java/dev/gitroot/pdv/src/main/java/lu/etat/pch/pdv/jsf/beans/myGuichet/myGuichetServlet.java:[3,40] package lu.etat.cie.fp.gun.core.appli.ws does not exist, /C:/java/dev/gitroot/pdv/src/main/java/lu/etat/pch/pdv/jsf/beans/myGuichet/myGuichetServlet.java:[4,40] package lu.etat.cie.fp.gun.core.appli.ws does not exist, /C:/java/dev/gitroot/pdv/src/main/java/lu/etat/pch/pdv/jsf/beans/myGuichet/myGuichetServlet.java:[6,40] package lu.etat.cie.fp.gun.core.appli.ws does not exist, /C:/java/dev/gitroot/pdv/src/main/java/lu/etat/pch/pdv/jsf/beans/action/PdvImportBean.java:[11,1] package lu.etat.cie.fp.gun.core.appli.ws does not exist, /C:/java/dev/gitroot/pdv/src/main/java/lu/etat/pch/pdv/jsf/beans/myGuichet/main.java:[3,1] package lu.etat.cie.fp.gun.core.appli.ws does not exist

未找到的包 lu.etat.cie.fp.gun.core.appli.ws 是我从 wsdl 文件中获得的包。但是这些文件存在于 target/test-classes 文件夹中。我不知道为什么我可以部署我的程序,但是由于找不到包,测试失败了。

有人可以指导我吗?

提前致谢。

标签: javatestingwsdljboss-arquillian

解决方案


推荐阅读